@@ -2422,13 +2422,13 @@ static void supplicant_run(struct supplicant *s, const char *binary)
24222422 argv [i ++ ] = (char * )binary ;
24232423
24242424 /* debugging? */
2425- if (arg_wpa_loglevel >= LOG_DEBUG )
2425+ if (wpa_loglevel >= LOG_DEBUG )
24262426 argv [i ++ ] = "-dd" ;
2427- else if (arg_wpa_loglevel >= LOG_INFO )
2427+ else if (wpa_loglevel >= LOG_INFO )
24282428 argv [i ++ ] = "-d" ;
2429- else if (arg_wpa_loglevel < LOG_ERROR )
2429+ else if (wpa_loglevel < LOG_ERROR )
24302430 argv [i ++ ] = "-qq" ;
2431- else if (arg_wpa_loglevel < LOG_NOTICE )
2431+ else if (wpa_loglevel < LOG_NOTICE )
24322432 argv [i ++ ] = "-q" ;
24332433
24342434 argv [i ++ ] = "-c" ;
@@ -2440,7 +2440,7 @@ static void supplicant_run(struct supplicant *s, const char *binary)
24402440 argv [i ++ ] = "-g" ;
24412441 argv [i ++ ] = s -> global_ctrl ;
24422442
2443- if (arg_wpa_syslog ) {
2443+ if (wpa_syslog ) {
24442444 argv [i ++ ] = "-s" ;
24452445 }
24462446
@@ -2452,45 +2452,45 @@ static void supplicant_run(struct supplicant *s, const char *binary)
24522452
24532453static int supplicant_find (char * * binary )
24542454{
2455- _shl_free_ char * path = getenv ("PATH" );
2456- if (!path ) {
2457- return - EINVAL ;
2458- }
2455+ _shl_free_ char * path = getenv ("PATH" );
2456+ if (!path ) {
2457+ return - EINVAL ;
2458+ }
24592459
2460- path = strdup (path );
2461- if (!path ) {
2462- return log_ENOMEM ();
2463- }
2460+ path = strdup (path );
2461+ if (!path ) {
2462+ return log_ENOMEM ();
2463+ }
2464+
2465+ struct stat bin_stat ;
2466+ char * curr = path , * next ;
2467+ while (1 ) {
2468+ curr = strtok_r (curr , ":" , & next );
2469+ if (!curr ) {
2470+ break ;
2471+ }
2472+
2473+ _shl_free_ char * bin = shl_strcat (curr , "/wpa_supplicant" );
2474+ if (!bin )
2475+ return log_ENOMEM ();
2476+
2477+ if (stat (bin , & bin_stat ) < 0 ) {
2478+ if (ENOENT == errno || ENOTDIR == errno ) {
2479+ goto end ;
2480+ }
2481+ return log_ERRNO ();
2482+ }
24642483
2465- struct stat bin_stat ;
2466- char * curr = path , * next ;
2467- while (1 ) {
2468- curr = strtok_r (curr , ":" , & next );
2469- if (!curr ) {
2470- break ;
2471- }
2472-
2473- _shl_free_ char * bin = shl_strcat (curr , "/wpa_supplicant" );
2474- if (!bin )
2475- return log_ENOMEM ();
2476-
2477- if (stat (bin , & bin_stat ) < 0 ) {
2478- if (ENOENT == errno || ENOTDIR == errno ) {
2479- goto end ;
2480- }
2481- return log_ERRNO ();
2482- }
2483-
2484- if (!access (bin , X_OK )) {
2485- * binary = strdup (bin );
2486- return 0 ;
2487- }
2484+ if (!access (bin , X_OK )) {
2485+ * binary = strdup (bin );
2486+ return 0 ;
2487+ }
24882488
24892489end :
2490- curr = NULL ;
2491- }
2490+ curr = NULL ;
2491+ }
24922492
2493- return - EINVAL ;
2493+ return - EINVAL ;
24942494}
24952495
24962496static int supplicant_spawn (struct supplicant * s )
@@ -2506,16 +2506,16 @@ static int supplicant_spawn(struct supplicant *s)
25062506
25072507 log_debug ("spawn supplicant of %s" , s -> l -> ifname );
25082508
2509- if (supplicant_find (& binary ) < 0 ) {
2510- if (binary != NULL ) {
2511- log_error ("execution of wpas (%s) not possible: %m" , binary );
2512- } else {
2513- log_error ("execution of wpas not possible: %m" );
2509+ if (supplicant_find (& binary ) < 0 ) {
2510+ if (binary != NULL ) {
2511+ log_error ("execution of wpas (%s) not possible: %m" , binary );
2512+ } else {
2513+ log_error ("execution of wpas not possible: %m" );
2514+ }
2515+ return - EINVAL ;
25142516 }
2515- return - EINVAL ;
2516- }
25172517
2518- log_info ("wpa_supplicant found: %s" , binary );
2518+ log_info ("wpa_supplicant found: %s" , binary );
25192519
25202520 pid = fork ();
25212521 if (pid < 0 ) {
@@ -2623,18 +2623,21 @@ static int supplicant_write_config(struct supplicant *s)
26232623 return log_ERRNO ();
26242624
26252625 r = fprintf (f ,
2626- "# Generated configuration - DO NOT EDIT!\n"
2627- "device_name=%s\n"
2628- "device_type=%s\n"
2629- "config_methods=%s\n"
2630- "driver_param=%s\n"
2631- "ap_scan=%s\n"
2632- "# End of configuration\n" ,
2633- s -> l -> friendly_name ?: "unknown" ,
2634- "1-0050F204-1" ,
2635- s -> l -> config_methods ?: "pbc" ,
2636- "p2p_device=1" ,
2637- "1" );
2626+ "# Generated configuration - DO NOT EDIT!\n"
2627+ "device_name=%s\n"
2628+ "device_type=%s\n"
2629+ "config_methods=%s\n"
2630+ "driver_param=%s\n"
2631+ "ap_scan=%s\n"
2632+ "p2p_go_intent=%d\n"
2633+ "# End of configuration\n" ,
2634+
2635+ s -> l -> friendly_name ?: "unknown" ,
2636+ "1-0050F204-1" ,
2637+ s -> l -> config_methods ?: "pbc" ,
2638+ s -> l -> driver_param ?: "" ,
2639+ "1" ,
2640+ s -> l -> go_intent ?: 0 );
26382641 if (r < 0 ) {
26392642 r = log_ERRNO ();
26402643 fclose (f );
0 commit comments