summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki2018-11-30 17:26:12 +0000
committerRafał Miłecki2018-12-05 20:56:37 +0000
commit1913feacb1ad1fb6433d316d81e2e3bee365ec19 (patch)
tree62e6f8d6070bd1e4bb96336e14c3929de85a9625
parent6b445fa39bc1ffa88e871c31999b57719c3909f8 (diff)
downloadfstools-1913feacb1ad1fb6433d316d81e2e3bee365ec19.tar.gz
block: don't duplicate unmounting code in the mount_action()
Use umount_device() helper instead. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-rw-r--r--block.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/block.c b/block.c
index e294ba4..46050b4 100644
--- a/block.c
+++ b/block.c
@@ -1105,27 +1105,17 @@ static int umount_device(char *path)
static int mount_action(char *action, char *device, int type)
{
char path[32];
- char *mount_point;
if (!action || !device)
return -1;
snprintf(path, sizeof(path), "/dev/%s", device);
if (!strcmp(action, "remove")) {
- int err = 0;
-
if (type == TYPE_HOTPLUG)
blockd_notify(device, NULL, NULL);
- mount_point = find_mount_point(path);
- if (mount_point)
- err = umount2(mount_point, MNT_DETACH);
-
- if (err)
- ULOG_ERR("umount of %s failed (%d) - %m\n",
- mount_point, errno);
+ umount_device(path);
- free(mount_point);
return 0;
} else if (strcmp(action, "add")) {
ULOG_ERR("Unkown action %s\n", action);