- /* set std fd's to /dev/null, /sbin/hotplug forks us, we don't have them at all */
- devnull = open("/dev/null", O_RDWR);
- if (devnull >= 0) {
- if (devnull != STDIN_FILENO)
- dup2(devnull, STDIN_FILENO);
- if (devnull != STDOUT_FILENO)
- dup2(devnull, STDOUT_FILENO);
- if (devnull != STDERR_FILENO)
- dup2(devnull, STDERR_FILENO);
- if (devnull > STDERR_FILENO)
- close(devnull);
- }
-
- logging_init("udev");
- if (devnull < 0)
- err("open /dev/null failed: %s\n", strerror(errno));
- udev_config_init();
- selinux_init();
- dbg("version %s\n", UDEV_VERSION);
-
- /* set signal handlers */
- memset(&act, 0x00, sizeof(act));
- act.sa_handler = (void (*)(int)) sig_handler;
- sigemptyset (&act.sa_mask);
- act.sa_flags = 0;
- sigaction(SIGALRM, &act, NULL);
- sigaction(SIGINT, &act, NULL);
- sigaction(SIGTERM, &act, NULL);