summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/udev/udevd.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 6cfb2bcfcd..f4076b1357 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1277,6 +1277,18 @@ int main(int argc, char *argv[]) {
udev_list_node_init(&event_list);
+ if (!arg_debug) {
+ int fd;
+
+ fd = open("/dev/null", O_RDWR);
+ if (fd >= 0) {
+ dup2(fd, STDIN_FILENO);
+ dup2(fd, STDOUT_FILENO);
+ dup2(fd, STDERR_FILENO);
+ close(fd);
+ }
+ }
+
fd_inotify = udev_watch_init(udev);
if (fd_inotify < 0) {
r = log_error_errno(ENOMEM, "error initializing inotify");