diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-21 19:11:23 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-21 19:11:23 +0000 |
commit | 3a014b85dc57a88b5e1eb006a2fa3062f4bebc8f (patch) | |
tree | 6befbfaa357218f40a809dc6135f621e0f2fc365 /libbb | |
parent | 05af832097848cbc0656e687fc4a07525c2de513 (diff) | |
download | busybox-w32-3a014b85dc57a88b5e1eb006a2fa3062f4bebc8f.tar.gz busybox-w32-3a014b85dc57a88b5e1eb006a2fa3062f4bebc8f.tar.bz2 busybox-w32-3a014b85dc57a88b5e1eb006a2fa3062f4bebc8f.zip |
ls: make readlink error to not disrupt output (try ls -l /proc/self/fd).
libbb: make xmalloc_readlink_or_warn warning more specific.
function old new delta
xmalloc_readlink_or_warn 33 61 +28
showfiles 1495 1460 -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 28/-35) Total: -7 bytes
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/xreadlink.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c index 6bff4beae..8d232f16b 100644 --- a/libbb/xreadlink.c +++ b/libbb/xreadlink.c | |||
@@ -91,7 +91,11 @@ char* FAST_FUNC xmalloc_readlink_or_warn(const char *path) | |||
91 | char *buf = xmalloc_readlink(path); | 91 | char *buf = xmalloc_readlink(path); |
92 | if (!buf) { | 92 | if (!buf) { |
93 | /* EINVAL => "file: Invalid argument" => puzzled user */ | 93 | /* EINVAL => "file: Invalid argument" => puzzled user */ |
94 | bb_error_msg("%s: cannot read link (not a symlink?)", path); | 94 | const char *errmsg = "not a symlink"; |
95 | int err = errno; | ||
96 | if (err != EINVAL) | ||
97 | errmsg = strerror(err); | ||
98 | bb_error_msg("%s: cannot read link: %s", path, errmsg); | ||
95 | } | 99 | } |
96 | return buf; | 100 | return buf; |
97 | } | 101 | } |