diff options
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udevd.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 933b60cdd5..4f43a6fe12 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -1434,57 +1434,57 @@ int main(int argc, char *argv[]) { goto exit; } - r = mac_selinux_init("/dev"); - if (r < 0) { - log_error_errno(r, "could not initialize labelling: %m"); - goto exit; - } + if (arg_children_max == 0) { + cpu_set_t cpu_set; - /* set umask before creating any file/directory */ - r = chdir("/"); - if (r < 0) { - r = log_error_errno(errno, "could not change dir to /: %m"); - goto exit; - } + arg_children_max = 8; - umask(022); + if (sched_getaffinity(0, sizeof (cpu_set), &cpu_set) == 0) { + arg_children_max += CPU_COUNT(&cpu_set) * 2; + } - r = mkdir("/run/udev", 0755); - if (r < 0 && errno != EEXIST) { - r = log_error_errno(errno, "could not create /run/udev: %m"); - goto exit; + log_debug("set children_max to %u", arg_children_max); } - dev_setup(NULL); - /* before opening new files, make sure std{in,out,err} fds are in a sane state */ if (arg_daemonize) { int fd; fd = open("/dev/null", O_RDWR); - if (fd >= 0) { + if (fd < 0) + log_error("cannot open /dev/null"); + else { if (write(STDOUT_FILENO, 0, 0) < 0) dup2(fd, STDOUT_FILENO); if (write(STDERR_FILENO, 0, 0) < 0) dup2(fd, STDERR_FILENO); if (fd > STDERR_FILENO) close(fd); - } else { - log_error("cannot open /dev/null"); } } - if (arg_children_max == 0) { - cpu_set_t cpu_set; + /* set umask before creating any file/directory */ + r = chdir("/"); + if (r < 0) { + r = log_error_errno(errno, "could not change dir to /: %m"); + goto exit; + } - arg_children_max = 8; + umask(022); - if (sched_getaffinity(0, sizeof (cpu_set), &cpu_set) == 0) { - arg_children_max += CPU_COUNT(&cpu_set) * 2; - } + r = mac_selinux_init("/dev"); + if (r < 0) { + log_error_errno(r, "could not initialize labelling: %m"); + goto exit; } - log_debug("set children_max to %u", arg_children_max); + r = mkdir("/run/udev", 0755); + if (r < 0 && errno != EEXIST) { + r = log_error_errno(errno, "could not create /run/udev: %m"); + goto exit; + } + + dev_setup(NULL); r = manager_new(&manager); if (r < 0) |