Changeset 8e3498b in mainline for uspace/app/tester/vfs/vfs1.c
- Timestamp:
- 2017-12-04T18:44:24Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bde5c04
- Parents:
- 40feeac
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/vfs/vfs1.c
r40feeac r8e3498b 84 84 85 85 size_t size = sizeof(text); 86 ssize_t cnt = vfs_write(fd0, &pos, text, size); 87 if (cnt < 0) 86 size_t cnt; 87 rc = vfs_write(fd0, &pos, text, size, &cnt); 88 if (rc != EOK) 88 89 return "write() failed"; 89 90 TPRINTF("Written %zd bytes\n", cnt); … … 93 94 char buf[BUF_SIZE]; 94 95 TPRINTF("read..\n"); 95 while (( cnt = vfs_read(fd0, &pos, buf, BUF_SIZE))) {96 TPRINTF("read returns %zd\n", cnt);97 if ( cnt < 0)96 while ((rc = vfs_read(fd0, &pos, buf, BUF_SIZE, &cnt))) { 97 TPRINTF("read returns rc = %d, cnt = %zu\n", rc, cnt); 98 if (rc != EOK) 98 99 return "read() failed"; 99 100 100 int _cnt = (int) cnt;101 if ( _cnt != cnt) {101 int icnt = (int) cnt; 102 if ((size_t) icnt != cnt) { 102 103 /* Count overflow, just to be sure. */ 103 104 TPRINTF("Read %zd bytes\n", cnt); 104 105 } else { 105 TPRINTF("Read %zd bytes: \"%.*s\"\n", cnt, _cnt, buf);106 TPRINTF("Read %zd bytes: \"%.*s\"\n", cnt, icnt, buf); 106 107 } 107 108 }
Note:
See TracChangeset
for help on using the changeset viewer.