Changes in uspace/app/bdsh/cmds/modules/cat/cat.c [582a0b8:f77c1c9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
r582a0b8 rf77c1c9 180 180 off64_t head, off64_t tail, bool tail_first) 181 181 { 182 int fd, bytes = 0, count = 0, reads = 0; 182 int fd, count = 0, reads = 0; 183 size_t bytes; 183 184 char *buff = NULL; 184 int i;185 size_t i; 185 186 size_t offset = 0, copied_bytes = 0; 186 187 off64_t file_size = 0, length = 0; 187 188 aoff64_t pos = 0; 189 int rc; 188 190 189 191 bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0); … … 193 195 /* Allow storing the whole UTF-8 character. */ 194 196 blen = STR_BOUNDS(1); 195 } else 196 fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ); 197 } else { 198 int rc = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ, &fd); 199 if (rc != EOK) { 200 fd = -1; 201 } 202 } 197 203 198 204 if (fd < 0) { … … 250 256 } 251 257 252 bytes = vfs_read(fd, &pos, buff + copied_bytes, bytes_to_read); 258 rc = vfs_read(fd, &pos, buff + copied_bytes, bytes_to_read, 259 &bytes); 253 260 copied_bytes = 0; 254 261 255 if ( bytes > 0) {262 if (rc == EOK && bytes > 0) { 256 263 buff[bytes] = '\0'; 257 264 offset = 0; … … 284 291 if (reading_stdin) 285 292 fflush(stdout); 286 } while ( bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));293 } while (rc == EOK && bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE)); 287 294 288 295 vfs_put(fd); 289 if ( bytes == -1) {296 if (rc != EOK) { 290 297 printf("Error reading %s\n", fname); 291 298 free(buff);
Note:
See TracChangeset
for help on using the changeset viewer.