diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-03 14:16:24 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-03 14:16:24 +0000 |
commit | 0e2c9fb4e09fb0c5a47ddc74b0ba53238570599e (patch) | |
tree | ab1416450c6c339fdbe3422a4e4243e7d2098541 /libbb | |
parent | f223efbcde63c0c01e5b1331f2fc7f1a9c812f20 (diff) | |
download | busybox-0e2c9fb4e09fb0c5a47ddc74b0ba53238570599e.tar.gz |
mount: print errno on NFS error (again)
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/loop.c | 7 | ||||
-rw-r--r-- | libbb/perror_msg.c | 6 | ||||
-rw-r--r-- | libbb/perror_msg_and_die.c | 6 |
3 files changed, 14 insertions, 5 deletions
diff --git a/libbb/loop.c b/libbb/loop.c index 9559d429a..6934b7a3b 100644 --- a/libbb/loop.c +++ b/libbb/loop.c @@ -81,7 +81,8 @@ int del_loop(const char *device) */ int set_loop(char **device, const char *file, unsigned long long offset) { - char dev[20], *try; + char dev[LOOP_NAMESIZE]; + char *try; bb_loop_info loopinfo; struct stat statbuf; int i, dfd, ffd, mode, rc = -1; @@ -140,14 +141,14 @@ int set_loop(char **device, const char *file, unsigned long long offset) rc = -1; } close(dfd); -try_again: + try_again: if (*device) break; } close(ffd); if (!rc) { if (!*device) *device = xstrdup(dev); - return (mode == O_RDONLY) ? 1 : 0; + return (mode == O_RDONLY); /* 1:ro, 0:rw */ } return rc; } diff --git a/libbb/perror_msg.c b/libbb/perror_msg.c index 5145795f5..2ec1a9b2a 100644 --- a/libbb/perror_msg.c +++ b/libbb/perror_msg.c @@ -14,6 +14,10 @@ void bb_perror_msg(const char *s, ...) va_list p; va_start(p, s); - bb_vperror_msg(s, p); + /* Guard against "<error message>: Success" */ + if (!errno) + bb_verror_msg(s, p, NULL); + else + bb_vperror_msg(s, p); va_end(p); } diff --git a/libbb/perror_msg_and_die.c b/libbb/perror_msg_and_die.c index 3a06b654b..90f56e04c 100644 --- a/libbb/perror_msg_and_die.c +++ b/libbb/perror_msg_and_die.c @@ -14,7 +14,11 @@ void bb_perror_msg_and_die(const char *s, ...) va_list p; va_start(p, s); - bb_vperror_msg(s, p); + /* Guard against "<error message>: Success" */ + if (!errno) + bb_verror_msg(s, p, NULL); + else + bb_vperror_msg(s, p); va_end(p); xfunc_die(); } |