Changes in uspace/app/bdsh/cmds/modules/mkdir/mkdir.c [738b549:6afc9d7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
r738b549 r6afc9d7 89 89 { 90 90 /* Ensure we would always work with absolute and canonified path. */ 91 char *path = absolutize(user_path, NULL);91 char *path = vfs_absolutize(user_path, NULL); 92 92 if (path == NULL) { 93 93 cli_error(CL_ENOMEM, "%s: path too big?", cmdname); … … 95 95 } 96 96 97 int rc;98 97 int ret = 0; 99 98 100 99 if (!create_parents) { 101 rc = mkdir(path, 0); 102 if (rc != EOK) { 100 if (mkdir(path, 0) != 0) { 103 101 cli_error(CL_EFAIL, "%s: could not create %s (%s)", 104 cmdname, path, str_error( rc));102 cmdname, path, str_error(errno)); 105 103 ret = 1; 106 104 } … … 137 135 char slash_char = path[prev_off]; 138 136 path[prev_off] = 0; 139 rc = mkdir(path, 0); 140 if (rc == EEXIST) { 141 rc = EOK; 142 } 143 144 if (rc != EOK) { 137 138 if (mkdir(path, 0) != 0 && errno != EEXIST) { 145 139 cli_error(CL_EFAIL, "%s: could not create %s (%s)", 146 cmdname, path, str_error( rc));140 cmdname, path, str_error(errno)); 147 141 ret = 1; 148 142 goto leave; … … 152 146 } 153 147 /* Create the final directory. */ 154 rc = mkdir(path, 0); 155 if (rc != EOK) { 148 if (mkdir(path, 0) != 0) { 156 149 cli_error(CL_EFAIL, "%s: could not create %s (%s)", 157 cmdname, path, str_error( rc));150 cmdname, path, str_error(errno)); 158 151 ret = 1; 159 152 } … … 173 166 argc = cli_count_args(argv); 174 167 175 for (c = 0, opt ind = 0, opt_ind = 0; c != -1;) {168 for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) { 176 169 c = getopt_long(argc, argv, "pvhVfm:", long_options, &opt_ind); 177 170 switch (c) { … … 214 207 215 208 if (follow && (argv[optind] != NULL)) { 216 chdir(argv[optind]); 209 if (chdir(argv[optind]) != 0) 210 printf("%s: Error switching to directory.", cmdname); 217 211 } 218 212
Note:
See TracChangeset
for help on using the changeset viewer.