Changeset 368ee04 in mainline for uspace/app/bdsh/cmds/modules/cmp/cmp.c
- Timestamp:
- 2017-04-05T18:10:39Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 93ad8166
- Parents:
- 39f892a9 (diff), 2166728 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cmp/cmp.c
r39f892a9 r368ee04 28 28 29 29 #include <errno.h> 30 #include <fcntl.h>31 30 #include <getopt.h> 32 31 #include <mem.h> … … 79 78 char buffer[2][CMP_BUFLEN]; 80 79 ssize_t offset[2]; 80 aoff64_t pos[2] = {}; 81 81 82 82 for (int i = 0; i < 2; i++) { 83 fd[i] = open(fn[i], O_RDONLY);83 fd[i] = vfs_lookup_open(fn[i], WALK_REGULAR, MODE_READ); 84 84 if (fd[i] < 0) { 85 rc = errno;85 rc = fd[i]; 86 86 printf("Unable to open %s\n", fn[i]); 87 87 goto end; … … 94 94 ssize_t size; 95 95 do { 96 size = read(fd[i], buffer[i] + offset[i], 96 size = vfs_read(fd[i], &pos[i], 97 buffer[i] + offset[i], 97 98 CMP_BUFLEN - offset[i]); 98 99 if (size < 0) { 99 rc = errno;100 rc = size; 100 101 printf("Error reading from %s\n", 101 102 fn[i]); … … 115 116 end: 116 117 if (fd[0] >= 0) 117 close(fd[0]);118 vfs_put(fd[0]); 118 119 if (fd[1] >= 0) 119 close(fd[1]);120 vfs_put(fd[1]); 120 121 return rc; 121 122 }
Note:
See TracChangeset
for help on using the changeset viewer.