Dont try and make the "/" directory
authorGlenn L McGrath <bug1@ihug.co.nz>
Sat, 19 Oct 2002 23:56:41 +0000 (23:56 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Sat, 19 Oct 2002 23:56:41 +0000 (23:56 -0000)
libbb/make_directory.c

index 3f81d9a..ca3eb49 100644 (file)
@@ -41,7 +41,7 @@
 int make_directory (char *path, long mode, int flags)
 {
        int ret;
-
+       
        /* Calling apps probably should use 0777 instead of -1
         * then we dont need this condition
         */
@@ -50,7 +50,7 @@ int make_directory (char *path, long mode, int flags)
        }
        if (flags == FILEUTILS_RECUR) {
                char *pp = strrchr(path, '/');
-               if (pp) {
+               if ((pp) && (pp != path)) {
                        *pp = '\0';
                        make_directory(path, mode, flags);
                        *pp = '/';