aboutsummaryrefslogtreecommitdiff
path: root/libbb/make_directory.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/make_directory.c')
-rw-r--r--libbb/make_directory.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libbb/make_directory.c b/libbb/make_directory.c
index 3f81d9ac2..ca3eb495c 100644
--- a/libbb/make_directory.c
+++ b/libbb/make_directory.c
@@ -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 = '/';