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