summaryrefslogtreecommitdiff
path: root/libbb/xreadlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/xreadlink.c')
-rw-r--r--libbb/xreadlink.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c
index 6bff4be..8d232f1 100644
--- a/libbb/xreadlink.c
+++ b/libbb/xreadlink.c
@@ -91,7 +91,11 @@ char* FAST_FUNC xmalloc_readlink_or_warn(const char *path)
char *buf = xmalloc_readlink(path);
if (!buf) {
/* EINVAL => "file: Invalid argument" => puzzled user */
- bb_error_msg("%s: cannot read link (not a symlink?)", path);
+ const char *errmsg = "not a symlink";
+ int err = errno;
+ if (err != EINVAL)
+ errmsg = strerror(err);
+ bb_error_msg("%s: cannot read link: %s", path, errmsg);
}
return buf;
}