aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-08-15 17:09:24 (GMT)
committerJouni Malinen <j@w1.fi>2009-11-25 22:52:43 (GMT)
commit040080a0eeeab42096523f060ae48fd3c772755b (patch)
tree52a2f272ca1bf2dd9e4c119ad6fdd5b12ce0f228
parent91690872f4c1236684489bcde99a52cbe428ee59 (diff)
downloadhostap-06-040080a0eeeab42096523f060ae48fd3c772755b.zip
hostap-06-040080a0eeeab42096523f060ae48fd3c772755b.tar.gz
hostap-06-040080a0eeeab42096523f060ae48fd3c772755b.tar.bz2
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. (cherry picked from commits cedf947308ed26d08aec391794a16c9f8d715023 and dd745de384a5d6398b62a2737f2b6bd581495de7)
-rw-r--r--hostapd/hostapd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hostapd/hostapd.c b/hostapd/hostapd.c
index e8a792e..3fbd3d0 100644
--- a/hostapd/hostapd.c
+++ b/hostapd/hostapd.c
@@ -1877,7 +1877,7 @@ int main(int argc, char *argv[])
int ret = 1, k;
size_t i, j;
int c, debug = 0, daemonize = 0, tnc = 0;
- const char *pid_file = NULL;
+ char *pid_file = NULL;
hostapd_logger_register_cb(hostapd_logger_cb);
@@ -1901,7 +1901,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++;
@@ -2032,6 +2033,7 @@ int main(int argc, char *argv[])
eap_server_unregister_methods();
os_daemonize_terminate(pid_file);
+ os_free(pid_file);
return ret;
}