mount: call hotplug mount scripts only on success
authorRafał Miłecki <rafal@milecki.pl>
Wed, 3 Jan 2018 10:31:21 +0000 (11:31 +0100)
committerJohn Crispin <john@phrozen.org>
Sun, 7 Jan 2018 11:48:36 +0000 (12:48 +0100)
If mounting fails for whatever reason (like unsupported file system or
something) hotplug.d scripts shouldn't be called.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
mount.c

diff --git a/mount.c b/mount.c
index caf9d9d7abcce8935b973271e3208bcaf0603ff5..803acc1fa8c7b644da82fb4d1bdf3573d59cf9f1 100644 (file)
--- a/mount.c
+++ b/mount.c
@@ -160,8 +160,8 @@ static void mount_add_list(char *name, char *dev, char *serial,
                snprintf(tmp, 64, "%s%s", uci_path, name);
                snprintf(tmp2, 64, "/tmp/run/mountd/%s", dev);
                symlink(tmp2, tmp);
-               mount_new("/tmp/run/mountd/", dev);
-               system_printf("ACTION=add DEVICE=%s NAME=%s /sbin/hotplug-call mount", dev, name);
+               if (!mount_new("/tmp/run/mountd/", dev))
+                       system_printf("ACTION=add DEVICE=%s NAME=%s /sbin/hotplug-call mount", dev, name);
        }
 }