Blob Blame History Raw
autofs-5.0.7 - fix check mkdir_path() in mount_bind.c:mount_mount()

From: Ian Kent <raven@themaw.net>


---
 modules/mount_bind.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/mount_bind.c b/modules/mount_bind.c
index d6c6fe7..61a773c 100644
--- a/modules/mount_bind.c
+++ b/modules/mount_bind.c
@@ -209,7 +209,12 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
 			      "failed to create local mount %s -> %s",
 			      fullpath, what);
 			if (ap->flags & MOUNT_FLAG_GHOST && !status)
-				mkdir_path(fullpath, 0555);
+				if (mkdir_path(fullpath, 0555) && errno != EEXIST) {
+					char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+					error(ap->logopt,
+					      MODPREFIX "mkdir_path %s failed: %s",
+					      fullpath, estr);
+				}
 			else {
 				if (ap->type == LKP_INDIRECT)
 					rmdir_path(ap, fullpath, ap->dev);