Changeset 34a74ab in mainline for uspace/lib/libc/generic/vfs/vfs.c
- Timestamp:
- 2008-08-11T16:40:29Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 17b2aac
- Parents:
- 9fcdb2e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/vfs/vfs.c
r9fcdb2e r34a74ab 63 63 { 64 64 char *ncwd_path; 65 char *ncwd_path_nc; 65 66 66 67 futex_down(&cwd_futex); … … 71 72 return NULL; 72 73 } 73 ncwd_path = malloc(len + cwd_len + 1);74 if (!ncwd_path ) {74 ncwd_path_nc = malloc(len + cwd_len + 1); 75 if (!ncwd_path_nc) { 75 76 futex_up(&cwd_futex); 76 77 return NULL; 77 78 } 78 strcpy(ncwd_path , cwd_path);79 ncwd_path [cwd_len] = '/';80 ncwd_path [cwd_len + 1] = '\0';79 strcpy(ncwd_path_nc, cwd_path); 80 ncwd_path_nc[cwd_len] = '/'; 81 ncwd_path_nc[cwd_len + 1] = '\0'; 81 82 } else { 82 ncwd_path = malloc(len + 1);83 if (!ncwd_path ) {83 ncwd_path_nc = malloc(len + 1); 84 if (!ncwd_path_nc) { 84 85 futex_up(&cwd_futex); 85 86 return NULL; 86 87 } 87 ncwd_path[0] = '\0'; 88 } 89 strcat(ncwd_path, path); 90 if (!canonify(ncwd_path, retlen)) { 88 ncwd_path_nc[0] = '\0'; 89 } 90 strcat(ncwd_path_nc, path); 91 ncwd_path = canonify(ncwd_path_nc, retlen); 92 if (!ncwd_path) { 91 93 futex_up(&cwd_futex); 92 free(ncwd_path); 94 free(ncwd_path_nc); 95 return NULL; 96 } 97 /* 98 * We need to clone ncwd_path because canonify() works in-place and thus 99 * the address in ncwd_path need not be the same as ncwd_path_nc, even 100 * though they both point into the same dynamically allocated buffer. 101 */ 102 ncwd_path = strdup(ncwd_path); 103 free(ncwd_path_nc); 104 if (!ncwd_path) { 105 futex_up(&cwd_futex); 93 106 return NULL; 94 107 }
Note:
See TracChangeset
for help on using the changeset viewer.