aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-03 14:16:24 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-03 14:16:24 +0000
commit0e2c9fb4e09fb0c5a47ddc74b0ba53238570599e (patch)
treeab1416450c6c339fdbe3422a4e4243e7d2098541 /libbb
parentf223efbcde63c0c01e5b1331f2fc7f1a9c812f20 (diff)
downloadbusybox-w32-0e2c9fb4e09fb0c5a47ddc74b0ba53238570599e.tar.gz
busybox-w32-0e2c9fb4e09fb0c5a47ddc74b0ba53238570599e.tar.bz2
busybox-w32-0e2c9fb4e09fb0c5a47ddc74b0ba53238570599e.zip
mount: print errno on NFS error (again)
Diffstat (limited to 'libbb')
-rw-r--r--libbb/loop.c7
-rw-r--r--libbb/perror_msg.c6
-rw-r--r--libbb/perror_msg_and_die.c6
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)
81 */ 81 */
82int set_loop(char **device, const char *file, unsigned long long offset) 82int set_loop(char **device, const char *file, unsigned long long offset)
83{ 83{
84 char dev[20], *try; 84 char dev[LOOP_NAMESIZE];
85 char *try;
85 bb_loop_info loopinfo; 86 bb_loop_info loopinfo;
86 struct stat statbuf; 87 struct stat statbuf;
87 int i, dfd, ffd, mode, rc = -1; 88 int i, dfd, ffd, mode, rc = -1;
@@ -140,14 +141,14 @@ int set_loop(char **device, const char *file, unsigned long long offset)
140 rc = -1; 141 rc = -1;
141 } 142 }
142 close(dfd); 143 close(dfd);
143try_again: 144 try_again:
144 if (*device) break; 145 if (*device) break;
145 } 146 }
146 close(ffd); 147 close(ffd);
147 if (!rc) { 148 if (!rc) {
148 if (!*device) 149 if (!*device)
149 *device = xstrdup(dev); 150 *device = xstrdup(dev);
150 return (mode == O_RDONLY) ? 1 : 0; 151 return (mode == O_RDONLY); /* 1:ro, 0:rw */
151 } 152 }
152 return rc; 153 return rc;
153} 154}
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, ...)
14 va_list p; 14 va_list p;
15 15
16 va_start(p, s); 16 va_start(p, s);
17 bb_vperror_msg(s, p); 17 /* Guard against "<error message>: Success" */
18 if (!errno)
19 bb_verror_msg(s, p, NULL);
20 else
21 bb_vperror_msg(s, p);
18 va_end(p); 22 va_end(p);
19} 23}
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, ...)
14 va_list p; 14 va_list p;
15 15
16 va_start(p, s); 16 va_start(p, s);
17 bb_vperror_msg(s, p); 17 /* Guard against "<error message>: Success" */
18 if (!errno)
19 bb_verror_msg(s, p, NULL);
20 else
21 bb_vperror_msg(s, p);
18 va_end(p); 22 va_end(p);
19 xfunc_die(); 23 xfunc_die();
20} 24}