Changeset 9c4cf0d in mainline for uspace/app/bdsh/cmds
- Timestamp:
- 2017-04-02T11:24:06Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 151f1cc
- Parents:
- b19e892
- Location:
- uspace/app/bdsh/cmds/modules
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
rb19e892 r9c4cf0d 203 203 204 204 if (NULL == (buff = (char *) malloc(blen + 1))) { 205 close(fd);205 vfs_put(fd); 206 206 printf("Unable to allocate enough memory to read %s\n", 207 207 fname); … … 213 213 214 214 if (vfs_stat(fd, &st) != EOK) { 215 close(fd);215 vfs_put(fd); 216 216 free(buff); 217 217 printf("Unable to vfs_stat %d\n", fd); … … 287 287 } while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE)); 288 288 289 close(fd);289 vfs_put(fd); 290 290 if (bytes == -1) { 291 291 printf("Error reading %s\n", fname); -
uspace/app/bdsh/cmds/modules/cmp/cmp.c
rb19e892 r9c4cf0d 116 116 end: 117 117 if (fd[0] >= 0) 118 close(fd[0]);118 vfs_put(fd[0]); 119 119 if (fd[1] >= 0) 120 close(fd[1]);120 vfs_put(fd[1]); 121 121 return rc; 122 122 } -
uspace/app/bdsh/cmds/modules/cp/cp.c
rb19e892 r9c4cf0d 391 391 if (fd2 < 0) { 392 392 printf("Unable to open destination file %s\n", dest); 393 close(fd1);393 vfs_put(fd1); 394 394 return -1; 395 395 } … … 397 397 if (vfs_stat(fd1, &st) != EOK) { 398 398 printf("Unable to fstat %d\n", fd1); 399 close(fd1);400 close(fd2);399 vfs_put(fd1); 400 vfs_put(fd2); 401 401 return -1; 402 402 } … … 425 425 426 426 out: 427 close(fd1);428 close(fd2);427 vfs_put(fd1); 428 vfs_put(fd2); 429 429 if (buff) 430 430 free(buff); -
uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
rb19e892 r9c4cf0d 168 168 rc2 = write(fd, &pos, &byte, sizeof(char)); 169 169 if (rc2 < 0) { 170 close(fd);170 vfs_put(fd); 171 171 goto error; 172 172 } … … 186 186 if (rc <= 0) { 187 187 printf("%s: Error writing file (%d).\n", cmdname, errno); 188 close(fd);188 vfs_put(fd); 189 189 free(buffer); 190 190 return CMD_FAILURE; … … 195 195 free(buffer); 196 196 197 if ( close(fd) < 0)197 if (vfs_put(fd) < 0) 198 198 goto error; 199 199 -
uspace/app/bdsh/cmds/modules/rm/rm.c
rb19e892 r9c4cf0d 152 152 fd = vfs_lookup(path, WALK_REGULAR); 153 153 if (fd >= 0) { 154 close(fd);154 vfs_put(fd); 155 155 return RM_FILE; 156 156 } -
uspace/app/bdsh/cmds/modules/touch/touch.c
rb19e892 r9c4cf0d 133 133 continue; 134 134 } else { 135 close(fd);135 vfs_put(fd); 136 136 fd = -1; 137 137 }
Note:
See TracChangeset
for help on using the changeset viewer.