Skip to content

Commit

Permalink
print dhcp commands
Browse files Browse the repository at this point in the history
  • Loading branch information
albfan committed Nov 20, 2022
1 parent aa06803 commit 301e977
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/wifi/wifid-supplicant.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,22 @@ static int supplicant_group_spawn_dhcp_server(struct supplicant_group *g,
}
argv[i] = NULL;

i = 0;
size_t size = 0;
while (argv[i]) {
size += strlen(argv[i++]) + 1;
}

gchar* dhcp_command = malloc(size);
i = 0;
strcpy(dhcp_command, argv[i++]);
while (argv[i]) {
strcat(dhcp_command, " ");
strcat(dhcp_command, argv[i++]);
}
log_debug("dhcp command:%s", dhcp_command);
g_free(dhcp_command);

if (execvpe(argv[0], argv, environ)< 0) {
log_error("dhcp failed (%d): %m", errno);
}
Expand Down Expand Up @@ -483,6 +499,22 @@ static int supplicant_group_spawn_dhcp_client(struct supplicant_group *g)
}
argv[i] = NULL;

i = 0;
size_t size = 0;
while (argv[i]) {
size += strlen(argv[i++]) + 1;
}

gchar* dhcp_command = malloc(size);
i = 0;
strcpy(dhcp_command, argv[i++]);
while (argv[i]) {
strcat(dhcp_command, " ");
strcat(dhcp_command, argv[i++]);
}
log_debug("dhcp command:%s", dhcp_command);
g_free(dhcp_command);

if (execvpe(argv[0], argv, environ) < 0) {
log_error("dhcp failed (%d): %m", errno);
}
Expand Down

0 comments on commit 301e977

Please sign in to comment.