summaryrefslogtreecommitdiffhomepage
path: root/libbb/device_open.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-11-06 03:05:54 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-11-06 03:05:54 +0000
commit6bef3d1d2216234454875052220ca0f477a820b4 (patch)
tree717060345370b781d3d1cde7ab4dd29304a066e8 /libbb/device_open.c
parent1bec1b980e3cf5ad604fb0c2038a3ab83d9ab5f5 (diff)
fbset: fix buglet where we were using wrong pointer
readahead: stop using stdio.h *: style fixes
Diffstat (limited to 'libbb/device_open.c')
-rw-r--r--libbb/device_open.c8
1 files changed, 5 insertions, 3 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 @@
/* 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. */