From 84965b92f635c09d11b640ebcb64402e09ae42b8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sat, 28 Dec 2019 22:29:03 +0100 Subject: [PATCH] blockd: print symlink error code and string message MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- 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.25.1