[PATCH] busybox: fix mkdir -p on read only file systems

Peter Korsgaard jacmet at uclibc.org
Wed May 14 09:19:09 UTC 2008


From: Peter Korsgaard <jacmet at sunsite.dk>

Read only file systems return EROFS on mkdir() even if the directory exists.
Update the check in bb_make_directory to handle EROFS like EEXIST.

Signed-off-by: Peter Korsgaard <jacmet at sunsite.dk>
---
 libbb/make_directory.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libbb/make_directory.c b/libbb/make_directory.c
index 8841c95..fa6d726 100644
--- a/libbb/make_directory.c
+++ b/libbb/make_directory.c
@@ -65,7 +65,7 @@ int bb_make_directory (char *path, long mode, int flags)
 		if (mkdir(path, 0777) < 0) {
 			/* If we failed for any other reason than the directory
 			 * already exists, output a diagnostic and return -1.*/
-			if (errno != EEXIST
+			if (!(errno == EEXIST || errno == EROFS)
 				|| !(flags & FILEUTILS_RECUR)
 				|| (stat(path, &st) < 0 || !S_ISDIR(st.st_mode))) {
 				fail_msg = "create";
-- 
1.5.5.1




More information about the busybox mailing list