traceroute: fix help text to not show -6 when traceroute6 is off
[oweals/busybox.git] / libbb / xreadlink.c
index 6bff4beaee51c3fe670821796cda0c77e9c84250..8d232f16b69003a2fb173ea522c3b07dfd42fd20 100644 (file)
@@ -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;
 }