From: Roy Marples Date: Tue, 27 May 2008 09:14:04 +0000 (+0000) Subject: Move NO_FORK code down so options is initialised. X-Git-Tag: v4.0.2~328 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f487abdb543bf9baeac87e9fecd220cf95930221;p=thirdparty%2Fdhcpcd.git Move NO_FORK code down so options is initialised. --- diff --git a/dhcpcd.c b/dhcpcd.c index 4ca3dc17..1dd63330 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -439,16 +439,6 @@ main(int argc, char **argv) closefrom(3); openlog(PACKAGE, LOG_PID, LOG_LOCAL0); -#ifdef THERE_IS_NO_FORK - dhcpcd_argv = argv; - dhcpcd_argc = argc; - if (!realpath(argv[0], dhcpcd)) { - fprintf(stderr, "unable to resolve the path `%s': %s", - argv[0], strerror(errno)); - goto abort; - } -#endif - options = xzalloc(sizeof(*options)); options->script = SCRIPT; snprintf(options->classid, CLASS_ID_MAX_LEN, "%s %s", @@ -482,6 +472,16 @@ main(int argc, char **argv) # endif #endif +#ifdef THERE_IS_NO_FORK + dhcpcd_argv = argv; + dhcpcd_argc = argc; + if (!realpath(argv[0], dhcpcd)) { + fprintf(stderr, "unable to resolve the path `%s': %s", + argv[0], strerror(errno)); + goto abort; + } +#endif + gethostname(options->hostname, sizeof(options->hostname)); if (strcmp(options->hostname, "(none)") == 0 || strcmp(options->hostname, "localhost") == 0)