[pisa-src] r1511 - trunk/pisasd/sdmain.c

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Wed, 04 Nov 2009 14:19:25 +0100

Author: tjansen
Date: Wed Nov  4 14:19:25 2009
New Revision: 1511

Log:
pisasd kill flag was broken in multiple ways:

The option is advertised as -k, --kill-running in the usage text, but
--kill-running wasn't added to the long options list.

Furthermore if the lock file is checked before we get a chance to parse the
command line options we cannot obey a -k.

Modified:
   trunk/pisasd/sdmain.c

Modified: trunk/pisasd/sdmain.c
==============================================================================
--- trunk/pisasd/sdmain.c       Wed Nov  4 14:13:45 2009        (r1510)
+++ trunk/pisasd/sdmain.c       Wed Nov  4 14:19:25 2009        (r1511)
@@ -55,6 +55,7 @@
        {"debug",               no_argument,            NULL,   'd'},
        {"version",             no_argument,            NULL,   'v'},
        {"help",                no_argument,            NULL,   'h'},
+       {"kill-running",        no_argument,            NULL,   'k'},
        {"authorized_config",   required_argument,      NULL,   'a'},
        {NULL,                  0,                      NULL,   '\0'}
 };
@@ -367,9 +368,6 @@
        /* Set default values in context */
        sdctx_init();
 
-       /* Check and create lockfile */
-       pisa_create_lock_file(PISASD_LOCK_FILE, sd_ctx.flag_kill_running);
-
        /* Set default values in config */
        sdconf_init();
 
@@ -378,6 +376,9 @@
         * sdconf_* operations except for sdconf_init. */
        sd_get_cmdargs(argc, argv);
 
+       /* Check and create lockfile */
+       pisa_create_lock_file(PISASD_LOCK_FILE, sd_ctx.flag_kill_running);
+
        /* Check, whether hipd is running. This is a requirement for
         * using pisasd. The output will be written to stderr before
         * pisasd is forking to background */

Other related posts:

  • » [pisa-src] r1511 - trunk/pisasd/sdmain.c - Thomas Jansen