diff --git a/scd/ChangeLog b/scd/ChangeLog index da3cdb42a..a55c51d53 100644 --- a/scd/ChangeLog +++ b/scd/ChangeLog @@ -1,3 +1,8 @@ +2002-08-21 Werner Koch + + * scdaemon.c (main): New option --daemon so that the program is + not accidently started in the background. + 2002-08-16 Werner Koch * scdaemon.c: Include i18n.h. diff --git a/scd/scdaemon.c b/scd/scdaemon.c index 6001faf5c..bc4a1e140 100644 --- a/scd/scdaemon.c +++ b/scd/scdaemon.c @@ -66,6 +66,7 @@ enum cmd_and_opt_values oNoGrab, oLogFile, oServer, + oDaemon, oBatch, aTest }; @@ -76,7 +77,8 @@ static ARGPARSE_OPTS opts[] = { { 301, NULL, 0, N_("@Options:\n ") }, - { oServer, "server", 0, N_("run in server mode") }, + { oServer, "server", 0, N_("run in server mode (foreground)") }, + { oDaemon, "daemon", 0, N_("run in daemon mode (background)") }, { oVerbose, "verbose", 0, N_("verbose") }, { oQuiet, "quiet", 0, N_("be somewhat more quiet") }, { oSh, "sh", 0, N_("sh-style command output") }, @@ -222,6 +224,7 @@ main (int argc, char **argv ) int greeting = 0; int nogreeting = 0; int pipe_server = 0; + int is_daemon = 0; int nodetach = 0; int csh_style = 0; char *logfile = NULL; @@ -237,10 +240,10 @@ main (int argc, char **argv ) /* check that the libraries are suitable. Do it here because the option parsing may need services of the library */ - if (!gcry_check_version ( "1.1.5" ) ) + if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) ) { log_fatal( _("libgcrypt is too old (need %s, have %s)\n"), - "1.1.5", gcry_check_version (NULL) ); + NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) ); } ksba_set_malloc_hooks (gcry_malloc, gcry_realloc, gcry_free); @@ -358,6 +361,7 @@ main (int argc, char **argv ) case oCsh: csh_style = 1; break; case oSh: csh_style = 0; break; case oServer: pipe_server = 1; break; + case oDaemon: is_daemon = 1; break; default : pargs.err = configfp? 1:2; break; } @@ -415,6 +419,11 @@ main (int argc, char **argv ) { /* this is the simple pipe based server */ scd_command_handler (-1); } + else if (!is_daemon) + { + log_info (_("please use the option `--daemon'" + " to run the program in the background\n")); + } else { /* regular server mode */ int fd; @@ -425,7 +434,7 @@ main (int argc, char **argv ) char *p; /* fixme: if there is already a running gpg-agent we should - sahre the same directory - and vice versa */ + share the same directory - and vice versa */ *socket_name = 0; snprintf (socket_name, DIM(socket_name)-1, "/tmp/gpg-XXXXXX/S.scdaemon");