Dont return an error if the directory already existed
authorGlenn L McGrath <bug1@ihug.co.nz>
Sat, 24 Aug 2002 20:11:38 +0000 (20:11 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Sat, 24 Aug 2002 20:11:38 +0000 (20:11 -0000)
libbb/make_directory.c

index 668fea7..1c3026c 100644 (file)
@@ -57,8 +57,12 @@ int make_directory (char *path, long mode, int flags)
                }
        }
        ret = mkdir(path, mode);
-       if ( (ret == -1) && (errno != EEXIST) ) {
-               perror_msg("Cannot create directory %s", path);
+       if (ret == -1) {
+               if (errno == EEXIST) {
+                       ret = 0;
+               } else {
+                       perror_msg("Cannot create directory %s", path);
+               }
        }
-       return ret;
+       return(ret);
 }