diff mbox series

wpa_supplicant: Store absolute path to P2P config file

Message ID 20260513065909.12048-4-andrei.otcheretianski@intel.com
State Accepted
Headers show
Series wpa_supplicant: Store absolute path to P2P config file | expand

Commit Message

Andrei Otcheretianski May 13, 2026, 6:59 a.m. UTC
When wpa_supplicant is daemonized, relative paths are not valid anymore.
If the P2P device is toggled (disabled/enabled) when wpa_supplicant runs
with -B option, the configuration isn't found and P2P device interface
can't be re-added.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
---
 wpa_supplicant/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Jouni Malinen May 20, 2026, 9:21 a.m. UTC | #1
On Wed, May 13, 2026 at 09:59:02AM +0300, Andrei Otcheretianski wrote:
> When wpa_supplicant is daemonized, relative paths are not valid anymore.
> If the P2P device is toggled (disabled/enabled) when wpa_supplicant runs
> with -B option, the configuration isn't found and P2P device interface
> can't be re-added.

Thanks, applied.
diff mbox series

Patch

diff --git a/wpa_supplicant/main.c b/wpa_supplicant/main.c
index ec8a90bc09..eeb3606ade 100644
--- a/wpa_supplicant/main.c
+++ b/wpa_supplicant/main.c
@@ -275,7 +275,8 @@  int main(int argc, char *argv[])
 			goto out;
 #ifdef CONFIG_P2P
 		case 'm':
-			params.conf_p2p_dev = optarg;
+			os_free(params.conf_p2p_dev);
+			params.conf_p2p_dev = os_rel2abs_path(optarg);
 			break;
 #endif /* CONFIG_P2P */
 		case 'o':
@@ -432,6 +433,9 @@  out:
 	os_free(params.match_ifaces);
 #endif /* CONFIG_MATCH_IFACE */
 	os_free(params.pid_file);
+#ifdef CONFIG_P2P
+	os_free(params.conf_p2p_dev);
+#endif /* CONFIG_P2P */
 
 	crypto_unload();
 	os_program_deinit();