aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/device_open.c8
-rw-r--r--libbb/dump.c6
-rw-r--r--libbb/obscure.c3
3 files changed, 11 insertions, 6 deletions
diff --git a/libbb/device_open.c b/libbb/device_open.c
index 2b35ad8a3..6907e9814 100644
--- a/libbb/device_open.c
+++ b/libbb/device_open.c
@@ -12,15 +12,17 @@
12/* try to open up the specified device */ 12/* try to open up the specified device */
13int device_open(const char *device, int mode) 13int device_open(const char *device, int mode)
14{ 14{
15 int m, f, fd = -1; 15 int m, f, fd;
16 16
17 m = mode | O_NONBLOCK; 17 m = mode | O_NONBLOCK;
18 18
19 /* Retry up to 5 times */ 19 /* Retry up to 5 times */
20 /* TODO: explain why it can't be considered insane */ 20 /* TODO: explain why it can't be considered insane */
21 for (f = 0; f < 5; f++) 21 for (f = 0; f < 5; f++) {
22 if ((fd = open(device, m, 0600)) >= 0) 22 fd = open(device, m, 0600);
23 if (fd >= 0)
23 break; 24 break;
25 }
24 if (fd < 0) 26 if (fd < 0)
25 return fd; 27 return fd;
26 /* Reset original flags. */ 28 /* Reset original flags. */
diff --git a/libbb/dump.c b/libbb/dump.c
index 829050d69..71e35c60f 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -59,7 +59,8 @@ int bb_dump_size(FS * fs)
59 prec = atoi(fmt); 59 prec = atoi(fmt);
60 while (isdigit(*++fmt)); 60 while (isdigit(*++fmt));
61 } 61 }
62 if (!(p = strchr(size_conv_str + 12, *fmt))) { 62 p = strchr(size_conv_str + 12, *fmt);
63 if (!p) {
63 if (*fmt == 's') { 64 if (*fmt == 's') {
64 bcnt += prec; 65 bcnt += prec;
65 } else if (*fmt == '_') { 66 } else if (*fmt == '_') {
@@ -162,7 +163,8 @@ static void rewrite(FS * fs)
162 DO_INT_CONV: 163 DO_INT_CONV:
163 { 164 {
164 const char *e; 165 const char *e;
165 if (!(e = strchr(lcc, *p1))) { 166 e = strchr(lcc, *p1);
167 if (!e) {
166 goto DO_BAD_CONV_CHAR; 168 goto DO_BAD_CONV_CHAR;
167 } 169 }
168 pr->flags = F_INT; 170 pr->flags = F_INT;
diff --git a/libbb/obscure.c b/libbb/obscure.c
index 2599095df..5cc906235 100644
--- a/libbb/obscure.c
+++ b/libbb/obscure.c
@@ -130,7 +130,8 @@ static const char *obscure_msg(const char *old_p, const char *new_p, const struc
130 c = 0; 130 c = 0;
131 p = new_p; 131 p = new_p;
132 while (1) { 132 while (1) {
133 if ((p = strchr(p, new_p[i])) == NULL) { 133 p = strchr(p, new_p[i]);
134 if (p == NULL) {
134 break; 135 break;
135 } 136 }
136 c++; 137 c++;