[Pkg-gnupg-commit] [gnupg2] 154/185: w32: Also change the directory on daemon startup.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Mon Aug 7 11:55:31 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gnupg2.
commit 0ef50340ef68b2541d9a1aafa71f5400aef4dc7e
Author: Werner Koch <wk at gnupg.org>
Date: Tue Jul 25 12:52:33 2017 +0200
w32: Also change the directory on daemon startup.
* agent/gpg-agent.c (main): Always to the chdir.
* dirmngr/dirmngr.c (main): Ditto.
* scd/scdaemon.c (main): Ditto.
--
Note that only dirmngr did not call the chdir with --no-detach. thus
we kept it this way.
Tested gpg-agent by checking the properties shown by procexp.
Gnupg-bug-id: 2670
Signed-off-by: Werner Koch <wk at gnupg.org>
---
agent/gpg-agent.c | 14 +++++++-------
dirmngr/dirmngr.c | 7 +++++--
scd/scdaemon.c | 4 ++--
3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index ef35174..36c05bc 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -1708,13 +1708,6 @@ main (int argc, char **argv )
opt.running_detached = 1;
}
- if (gnupg_chdir (gnupg_daemon_rootdir ()))
- {
- log_error ("chdir to '%s' failed: %s\n",
- gnupg_daemon_rootdir (), strerror (errno));
- exit (1);
- }
-
{
struct sigaction sa;
@@ -1725,6 +1718,13 @@ main (int argc, char **argv )
}
#endif /*!HAVE_W32_SYSTEM*/
+ if (gnupg_chdir (gnupg_daemon_rootdir ()))
+ {
+ log_error ("chdir to '%s' failed: %s\n",
+ gnupg_daemon_rootdir (), strerror (errno));
+ exit (1);
+ }
+
log_info ("%s %s started\n", strusage(11), strusage(13) );
handle_connections (fd, fd_extra, fd_browser, fd_ssh);
assuan_sock_close (fd);
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 436c808..5f3a4cd 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -1351,15 +1351,18 @@ main (int argc, char **argv)
log_set_prefix (NULL, oldflags | GPGRT_LOG_RUN_DETACHED);
opt.running_detached = 1;
+ }
+#endif
+
+ if (!nodetach )
+ {
if (gnupg_chdir (gnupg_daemon_rootdir ()))
{
log_error ("chdir to '%s' failed: %s\n",
gnupg_daemon_rootdir (), strerror (errno));
dirmngr_exit (1);
}
-
}
-#endif
thread_init ();
cert_cache_init (hkp_cacert_filenames);
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index bf3f42a..60d539d 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -908,6 +908,8 @@ main (int argc, char **argv )
sigaction (SIGPIPE, &sa, NULL);
}
+#endif /*!HAVE_W32_SYSTEM*/
+
if (gnupg_chdir (gnupg_daemon_rootdir ()))
{
log_error ("chdir to '%s' failed: %s\n",
@@ -915,8 +917,6 @@ main (int argc, char **argv )
exit (1);
}
-#endif /*!HAVE_W32_SYSTEM*/
-
handle_connections (fd);
close (fd);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list