summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2015-06-18 10:36:37 -0400
committerAnthony G. Basile <blueness@gentoo.org>2015-06-18 12:32:17 -0400
commit7061de26fa038719b70f6fdf971acf8ff807fd2f (patch)
tree5feaf67f6c621c0e478cd281ac87eb2a606a6ccf /src/udev
parent3c49a3776a4be84b423ec3e5cb725225ea4e443a (diff)
Revert "udev: don't close std{in,out,err}"
This reverts commit b2399d9b7222abe7db8ab4bc16e0efe3ccae4c42. This solves issue #108. While upstream also reverted this commit, they did so using functions in terminal-util.c. We could import that file and those functions but for such a small commit, its not worth it. We may do so at some future time if there are further gains. See: https://github.com/systemd/systemd/commit/40e749b59ba49fb97c1f45859debe2a82bc9c9ef Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev')
-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");