[OpenWrt-Devel] [PATCH fstools] blockd: print symlink error code and string message
Rafał Miłecki
zajec5 at gmail.com
Sat Dec 28 16:29:03 EST 2019
From: Rafał Miłecki <rafal at milecki.pl>
It may help understanding failure reason, e.g.:
blockd: failed to symlink /mnt/sda1->/tmp/run/blockd/sda1 (17) - File exists
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
blockd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/blockd.c b/blockd.c
index e07530c..a04ea5b 100644
--- a/blockd.c
+++ b/blockd.c
@@ -138,7 +138,7 @@ device_add(struct device *device)
snprintf(path, sizeof(path), "/tmp/run/blockd/%s", device->name);
if (symlink(path, device->target))
- ULOG_ERR("failed to symlink %s->%s\n", device->target, path);
+ ULOG_ERR("failed to symlink %s->%s (%d) - %m\n", device->target, path, errno);
else
block("autofs", "available", device->name);
}
@@ -158,7 +158,7 @@ device_move(struct device *device_o, struct device *device_n)
unlink(device_o->target);
snprintf(path, sizeof(path), "/tmp/run/blockd/%s", device_n->name);
if (symlink(path, device_n->target))
- ULOG_ERR("failed to symlink %s->%s\n", device_n->target, path);
+ ULOG_ERR("failed to symlink %s->%s (%d) - %m\n", device_n->target, path, errno);
} else {
mkdir(device_n->target, 0755);
if (mount(device_o->target, device_n->target, NULL, MS_MOVE, NULL))
--
2.21.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list