daemon-windows: Recognize --no-chdir option for windows.
authorGurucharan Shetty <shettyg@nicira.com>
Fri, 18 Apr 2014 18:04:14 +0000 (11:04 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Wed, 23 Apr 2014 15:59:59 +0000 (08:59 -0700)
The option won't have any effect on the running of the daemon.
Recognizing the option lets us avoid if else conditions in unit
tests.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/daemon.h

index 0384b64..a5f99d5 100644 (file)
@@ -80,6 +80,7 @@ pid_t read_pidfile(const char *name);
 #else
 #define DAEMON_OPTION_ENUMS                    \
     OPT_DETACH,                                \
 #else
 #define DAEMON_OPTION_ENUMS                    \
     OPT_DETACH,                                \
+    OPT_NO_CHDIR,                              \
     OPT_PIDFILE,                               \
     OPT_PIPE_HANDLE,                           \
     OPT_SERVICE,                               \
     OPT_PIDFILE,                               \
     OPT_PIPE_HANDLE,                           \
     OPT_SERVICE,                               \
@@ -87,6 +88,7 @@ pid_t read_pidfile(const char *name);
 
 #define DAEMON_LONG_OPTIONS                                               \
         {"detach",             no_argument, NULL, OPT_DETACH},            \
 
 #define DAEMON_LONG_OPTIONS                                               \
         {"detach",             no_argument, NULL, OPT_DETACH},            \
+        {"no-chdir",           no_argument, NULL, OPT_NO_CHDIR},          \
         {"pidfile",            optional_argument, NULL, OPT_PIDFILE},     \
         {"pipe-handle",        required_argument, NULL, OPT_PIPE_HANDLE}, \
         {"service",            no_argument, NULL, OPT_SERVICE},           \
         {"pidfile",            optional_argument, NULL, OPT_PIDFILE},     \
         {"pipe-handle",        required_argument, NULL, OPT_PIPE_HANDLE}, \
         {"service",            no_argument, NULL, OPT_SERVICE},           \
@@ -96,6 +98,9 @@ pid_t read_pidfile(const char *name);
         case OPT_DETACH:                        \
             break;                              \
                                                 \
         case OPT_DETACH:                        \
             break;                              \
                                                 \
+        case OPT_NO_CHDIR:                      \
+            break;                              \
+                                                \
         case OPT_PIDFILE:                       \
             set_pidfile(optarg);                \
             break;                              \
         case OPT_PIDFILE:                       \
             set_pidfile(optarg);                \
             break;                              \