aboutsummaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/utility.c b/utility.c
index a27aaa2ae..6d7fa955b 100644
--- a/utility.c
+++ b/utility.c
@@ -1121,6 +1121,28 @@ extern long getNum (const char *cp)
1121#endif /* BB_DD || BB_TAIL */ 1121#endif /* BB_DD || BB_TAIL */
1122 1122
1123 1123
1124#if defined BB_INIT || defined BB_SYSLOGD
1125/* try to open up the specified device */
1126extern int device_open(char *device, int mode)
1127{
1128 int m, f, fd = -1;
1129
1130 m = mode | O_NONBLOCK;
1131
1132 /* Retry up to 5 times */
1133 for (f = 0; f < 5; f++)
1134 if ((fd = open(device, m, 0600)) >= 0)
1135 break;
1136 if (fd < 0)
1137 return fd;
1138 /* Reset original flags. */
1139 if (m != mode)
1140 fcntl(fd, F_SETFL, mode);
1141 return fd;
1142}
1143#endif /* BB_INIT BB_SYSLOGD */
1144
1145
1124#if defined BB_INIT || defined BB_HALT || defined BB_REBOOT 1146#if defined BB_INIT || defined BB_HALT || defined BB_REBOOT
1125 1147
1126#if ! defined BB_FEATURE_USE_PROCFS 1148#if ! defined BB_FEATURE_USE_PROCFS