From 6bef3d1d2216234454875052220ca0f477a820b4 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 6 Nov 2007 03:05:54 +0000 Subject: fbset: fix buglet where we were using wrong pointer readahead: stop using stdio.h *: style fixes --- libbb/device_open.c | 8 +++++--- libbb/dump.c | 6 ++++-- libbb/obscure.c | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'libbb') 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 @@ /* try to open up the specified device */ int device_open(const char *device, int mode) { - int m, f, fd = -1; + int m, f, fd; m = mode | O_NONBLOCK; /* Retry up to 5 times */ /* TODO: explain why it can't be considered insane */ - for (f = 0; f < 5; f++) - if ((fd = open(device, m, 0600)) >= 0) + for (f = 0; f < 5; f++) { + fd = open(device, m, 0600); + if (fd >= 0) break; + } if (fd < 0) return fd; /* 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) prec = atoi(fmt); while (isdigit(*++fmt)); } - if (!(p = strchr(size_conv_str + 12, *fmt))) { + p = strchr(size_conv_str + 12, *fmt); + if (!p) { if (*fmt == 's') { bcnt += prec; } else if (*fmt == '_') { @@ -162,7 +163,8 @@ static void rewrite(FS * fs) DO_INT_CONV: { const char *e; - if (!(e = strchr(lcc, *p1))) { + e = strchr(lcc, *p1); + if (!e) { goto DO_BAD_CONV_CHAR; } 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 c = 0; p = new_p; while (1) { - if ((p = strchr(p, new_p[i])) == NULL) { + p = strchr(p, new_p[i]); + if (p == NULL) { break; } c++; -- cgit v1.2.3-55-g6feb