From: Jouni Malinen Date: Sat, 15 Aug 2009 17:09:24 +0000 (+0300) Subject: Figure out absolute path for the pid file before daemonizing X-Git-Tag: hostap_0_7_0~239 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cedf947308ed26d08aec391794a16c9f8d715023;p=thirdparty%2Fhostap.git Figure out absolute path for the pid file before daemonizing This allows relative path to be used in the same way as was already supported by wpa_supplicant. --- diff --git a/hostapd/main.c b/hostapd/main.c index 51bfd3b92..b582b2d44 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -393,7 +393,7 @@ int main(int argc, char *argv[]) int ret = 1; size_t i; int c, debug = 0, daemonize = 0; - const char *pid_file = NULL; + char *pid_file = NULL; for (;;) { c = getopt(argc, argv, "BdhKP:tv"); @@ -415,7 +415,8 @@ int main(int argc, char *argv[]) wpa_debug_show_keys++; break; case 'P': - pid_file = optarg; + os_free(pid_file); + pid_file = os_rel2abs_path(optarg); break; case 't': wpa_debug_timestamp++; @@ -459,6 +460,7 @@ int main(int argc, char *argv[]) ret = 0; out: + os_free(pid_file); /* Deinitialize all interfaces */ for (i = 0; i < interfaces.count; i++) hostapd_interface_deinit(interfaces.iface[i]);