12345678910111213141516171819202122232425262728293031 |
- #include "libbb.h"
- int FAST_FUNC device_open(const char *device, int mode)
- {
- int m, f, fd;
- m = mode | O_NONBLOCK;
-
-
- for (f = 0; f < 5; f++) {
- fd = open(device, m, 0600);
- if (fd >= 0)
- break;
- }
- if (fd < 0)
- return fd;
-
- if (m != mode)
- fcntl(fd, F_SETFL, mode);
- return fd;
- }
|