From e77dc6d122ea398e319c8cc310077deb4b096362 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 16 Feb 2018 12:50:24 +0100 Subject: [PATCH] mount: reorder deleting code in the mount_enum_drives() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Make it execute required unmount code first and then take care of removing entry from the internal list. This is a small cleanup grouping code by their purpose. Signed-off-by: Rafał Miłecki --- mount.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mount.c b/mount.c index f2c15a0..b488ede 100644 --- a/mount.c +++ b/mount.c @@ -757,16 +757,18 @@ static void mount_enum_drives(void) if(!check_block(q->dev)||del) { mount_dev_del(q); - p->prev->next = p->next; - p->next->prev = p->prev; - p = p->next; if (q->status == STATUS_MOUNTED || q->status == STATUS_EXPIRED) { snprintf(tmp, 64, "%s%s", uci_path, q->name); log_printf("unlinking %s\n", tmp); unlink(tmp); system_printf("ACTION=remove DEVICE=%s NAME=%s /sbin/hotplug-call mount", q->dev, q->name); } + + p->prev->next = p->next; + p->next->prev = p->prev; + p = p->next; free(q); + mount_dump_uci_state(); system_printf("/etc/fonstated/ReloadSamba"); } else p = p->next; -- 2.25.1