Return only full network line in list_networks
It makes more sense to truncate at line boundary especially with the new LAST_ID parameter. Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
This commit is contained in:
parent
8201054da6
commit
f34891a3af
1 changed files with 6 additions and 5 deletions
|
@ -2050,7 +2050,7 @@ static int wpa_supplicant_ctrl_iface_log_level(struct wpa_supplicant *wpa_s,
|
||||||
static int wpa_supplicant_ctrl_iface_list_networks(
|
static int wpa_supplicant_ctrl_iface_list_networks(
|
||||||
struct wpa_supplicant *wpa_s, char *cmd, char *buf, size_t buflen)
|
struct wpa_supplicant *wpa_s, char *cmd, char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
char *pos, *end;
|
char *pos, *end, *prev;
|
||||||
struct wpa_ssid *ssid;
|
struct wpa_ssid *ssid;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -2075,11 +2075,12 @@ static int wpa_supplicant_ctrl_iface_list_networks(
|
||||||
}
|
}
|
||||||
|
|
||||||
while (ssid) {
|
while (ssid) {
|
||||||
|
prev = pos;
|
||||||
ret = os_snprintf(pos, end - pos, "%d\t%s",
|
ret = os_snprintf(pos, end - pos, "%d\t%s",
|
||||||
ssid->id,
|
ssid->id,
|
||||||
wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
|
wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
|
||||||
if (ret < 0 || ret >= end - pos)
|
if (ret < 0 || ret >= end - pos)
|
||||||
return pos - buf;
|
return prev - buf;
|
||||||
pos += ret;
|
pos += ret;
|
||||||
if (ssid->bssid_set) {
|
if (ssid->bssid_set) {
|
||||||
ret = os_snprintf(pos, end - pos, "\t" MACSTR,
|
ret = os_snprintf(pos, end - pos, "\t" MACSTR,
|
||||||
|
@ -2088,7 +2089,7 @@ static int wpa_supplicant_ctrl_iface_list_networks(
|
||||||
ret = os_snprintf(pos, end - pos, "\tany");
|
ret = os_snprintf(pos, end - pos, "\tany");
|
||||||
}
|
}
|
||||||
if (ret < 0 || ret >= end - pos)
|
if (ret < 0 || ret >= end - pos)
|
||||||
return pos - buf;
|
return prev - buf;
|
||||||
pos += ret;
|
pos += ret;
|
||||||
ret = os_snprintf(pos, end - pos, "\t%s%s%s%s",
|
ret = os_snprintf(pos, end - pos, "\t%s%s%s%s",
|
||||||
ssid == wpa_s->current_ssid ?
|
ssid == wpa_s->current_ssid ?
|
||||||
|
@ -2099,11 +2100,11 @@ static int wpa_supplicant_ctrl_iface_list_networks(
|
||||||
ssid->disabled == 2 ? "[P2P-PERSISTENT]" :
|
ssid->disabled == 2 ? "[P2P-PERSISTENT]" :
|
||||||
"");
|
"");
|
||||||
if (ret < 0 || ret >= end - pos)
|
if (ret < 0 || ret >= end - pos)
|
||||||
return pos - buf;
|
return prev - buf;
|
||||||
pos += ret;
|
pos += ret;
|
||||||
ret = os_snprintf(pos, end - pos, "\n");
|
ret = os_snprintf(pos, end - pos, "\n");
|
||||||
if (ret < 0 || ret >= end - pos)
|
if (ret < 0 || ret >= end - pos)
|
||||||
return pos - buf;
|
return prev - buf;
|
||||||
pos += ret;
|
pos += ret;
|
||||||
|
|
||||||
ssid = ssid->next;
|
ssid = ssid->next;
|
||||||
|
|
Loading…
Reference in a new issue