diff options
author | Werner Koch <[email protected]> | 2016-11-16 20:17:47 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2016-11-16 20:17:47 +0000 |
commit | 4839e6d002a8ad1f7d3260792c3c9641e258f342 (patch) | |
tree | a578efc00d6a60dc6ddc36372e41948b92a0d1a2 /dirmngr/dirmngr.c | |
parent | common: Rename keybox_file_rename to gnupg_rename_file. (diff) | |
download | gnupg-4839e6d002a8ad1f7d3260792c3c9641e258f342.tar.gz gnupg-4839e6d002a8ad1f7d3260792c3c9641e258f342.zip |
scd,dirmngr: Keep the standard fds when daemonizing.
* dirmngr/dirmngr.c (main): Before calling setsid do not close the
standard fds but connect them to /dev/null.
* scd/scdaemon.c (main): Ditto. Noet that the old test for a log
stream was even reverted.
--
Note that this was fixed for gpg-agent 10 years ago on 2006-11-09.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'dirmngr/dirmngr.c')
-rw-r--r-- | dirmngr/dirmngr.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index 254c54341..db5079c5d 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -1209,8 +1209,18 @@ main (int argc, char **argv) for (i=0; i <= 2; i++) { if (!log_test_fd (i) && i != fd ) - close (i); + { + if ( !close (i) + && open ("/dev/null", i? O_WRONLY : O_RDONLY) == -1) + { + log_error ("failed to open '%s': %s\n", + "/dev/null", strerror (errno)); + cleanup (); + dirmngr_exit (1); + } + } } + if (setsid() == -1) { log_error ("setsid() failed: %s\n", strerror(errno) ); |