summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2018-11-30 14:09:21 +0100
committerRafał Miłecki <rafal@milecki.pl>2018-12-04 09:15:31 +0100
commit29717790c905ad3c67a6b66d04a50393b5435c56 (patch)
treeb340406529b688318777f0910d777dbccd182323
parentb86bd6ef92652014c8ae533c4878e7fb10757f46 (diff)
downloadfstools-29717790c905ad3c67a6b66d04a50393b5435c56.tar.gz
block: move blockd_notify() call out of the conditional blocks
That function is called no matter if "m" variable is null or not. This saves a one duplicated line & allows merging two conditional blocks starting with if (m). It doesn't change code execution order. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Reviewed-by: Michael Heimpold <mhei@heimpold.de>
-rw-r--r--block.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/block.c b/block.c
index d87251d..f42d0d6 100644
--- a/block.c
+++ b/block.c
@@ -1021,10 +1021,16 @@ static int mount_device(struct probe_info *pr, int type)
if (m && m->extroot)
return -1;
+ if (type == TYPE_HOTPLUG)
+ blockd_notify(device, m, pr);
+
if (m) {
+ char *target = m->target;
+ char _target[32];
+ int err = 0;
+
switch (type) {
case TYPE_HOTPLUG:
- blockd_notify(device, m, pr);
if (m->autofs)
return 0;
if (!auto_mount)
@@ -1039,14 +1045,6 @@ static int mount_device(struct probe_info *pr, int type)
return -1;
break;
}
- } else if (type == TYPE_HOTPLUG) {
- blockd_notify(device, NULL, pr);
- }
-
- if (m) {
- char *target = m->target;
- char _target[32];
- int err = 0;
if (m->autofs) {
snprintf(_target, sizeof(_target), "/tmp/run/blockd/%s", device);