summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2019-12-28 22:29:03 +0100
committerRafał Miłecki <rafal@milecki.pl>2020-03-21 22:39:03 +0100
commit84965b92f635c09d11b640ebcb64402e09ae42b8 (patch)
treee5b928ee62926c4255a5cf28d93b7374e8899ff4
parentdeb745f82b93b3bd12273cfb16deb7417fc555ef (diff)
downloadfstools-84965b92f635c09d11b640ebcb64402e09ae42b8.tar.gz
blockd: print symlink error code and string message
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@milecki.pl>
-rw-r--r--blockd.c4
1 files 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))