From 978f3dc4c8dec10699e0696b6524c0cf0f39b789 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Wed, 14 May 2008 11:14:38 +0200 Subject: [PATCH] busybox: fix mkdir -p on read only file systems 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 --- 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