goto exit;
}
+ /* setup signal handler pipe */
+ retval = pipe(signal_pipe);
+ if (retval < 0) {
+ err("error getting pipes: %s", strerror(errno));
+ goto exit;
+ }
+
+ retval = fcntl(signal_pipe[READ_END], F_GETFL, 0);
+ if (retval < 0) {
+ err("error fcntl on read pipe: %s", strerror(errno));
+ goto exit;
+ }
+ retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK);
+ if (retval < 0) {
+ err("error fcntl on read pipe: %s", strerror(errno));
+ goto exit;
+ }
+
+ retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0);
+ if (retval < 0) {
+ err("error fcntl on write pipe: %s", strerror(errno));
+ goto exit;
+ }
+ retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK);
+ if (retval < 0) {
+ err("error fcntl on write pipe: %s", strerror(errno));
+ goto exit;
+ }
+
/* parse the rules and keep them in memory */
sysfs_init();
udev_rules_init(&rules, 1);
close(fd);
}
- /* setup signal handler pipe */
- retval = pipe(signal_pipe);
- if (retval < 0) {
- err("error getting pipes: %s", strerror(errno));
- goto exit;
- }
-
- retval = fcntl(signal_pipe[READ_END], F_GETFL, 0);
- if (retval < 0) {
- err("error fcntl on read pipe: %s", strerror(errno));
- goto exit;
- }
- retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK);
- if (retval < 0) {
- err("error fcntl on read pipe: %s", strerror(errno));
- goto exit;
- }
-
- retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0);
- if (retval < 0) {
- err("error fcntl on write pipe: %s", strerror(errno));
- goto exit;
- }
- retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK);
- if (retval < 0) {
- err("error fcntl on write pipe: %s", strerror(errno));
- goto exit;
- }
-
/* set signal handlers */
memset(&act, 0x00, sizeof(struct sigaction));
act.sa_handler = (void (*)(int)) sig_handler;