mount: better logging for failed mounts
authorRobert Swiecki <robert@swiecki.net>
Sat, 27 May 2017 17:11:19 +0000 (19:11 +0200)
committerRobert Swiecki <robert@swiecki.net>
Sat, 27 May 2017 17:11:19 +0000 (19:11 +0200)
mount.c

diff --git a/mount.c b/mount.c
index b19311464c321a78322739ff87d577eca339cb8a..c5e379d5d3964b519851bf8026a5df131ec65ee7 100644 (file)
--- a/mount.c
+++ b/mount.c
@@ -160,12 +160,16 @@ static bool mountMount(struct nsjconf_t *nsjconf, struct mounts_t *mpt, const ch
        if (mount(srcpath, dst, mpt->fs_type, flags, mpt->options) == -1) {
                if (errno == EACCES) {
                        PLOG_W
-                           ("mount('%s', '%s', fstype:'%s') failed. Try fixing this problem by applying 'chmod o+x' to the '%s' directory and its ancestors",
-                            srcpath, dst, mpt->fs_type ? mpt->fs_type : "[NULL]", nsjconf->chroot);
+                           ("mount(src:'%s', dst:'%s', fstype:'%s', flags:'%s', mandatory:%s) failed. "
+                            "Try fixing this problem by applying 'chmod o+x' to the '%s' directory and "
+                            "its ancestors", srcpath, dst, mpt->fs_type ? mpt->fs_type : "[NULL]",
+                            mountFlagsToStr(mpt->flags), nsjconf->chroot,
+                            mpt->mandatory ? "true" : "false");
                } else {
-                       PLOG_W("mount('%s', '%s', fstype='%s', mandatory:%s) failed", srcpath, dst,
-                              mpt->fs_type ? mpt->fs_type : "[NULL]",
-                              mpt->mandatory ? "true" : "false");
+                       PLOG_W
+                           ("mount(src:'%s', dst:'%s', fstype:'%s', flags:'%s' mandatory:%s) failed",
+                            srcpath, dst, mpt->fs_type ? mpt->fs_type : "[NULL]",
+                            mountFlagsToStr(mpt->flags), mpt->mandatory ? "true" : "false");
                }
                if (mpt->mandatory) {
                        return false;