2006-02-05 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerUtils.c - (nm_utils_supplicant_request_with_check, nm_utils_supplicant_request): Handle newline killing better git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1444 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2006-02-05 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* src/NetworkManagerUtils.c
|
||||||
|
- (nm_utils_supplicant_request_with_check, nm_utils_supplicant_request):
|
||||||
|
Handle newline killing better
|
||||||
|
|
||||||
2006-02-05 Dan Williams <dcbw@redhat.com>
|
2006-02-05 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* gnome/applet/nm-gconf-wso.c
|
* gnome/applet/nm-gconf-wso.c
|
||||||
|
@@ -703,6 +703,19 @@ int nm_utils_ip4_netmask_to_prefix (guint32 ip4_netmask)
|
|||||||
#define SUPPLICANT_DEBUG
|
#define SUPPLICANT_DEBUG
|
||||||
#define RESPONSE_SIZE 2048
|
#define RESPONSE_SIZE 2048
|
||||||
|
|
||||||
|
|
||||||
|
static char *
|
||||||
|
kill_newline (char *s, size_t *l)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (l != NULL, s);
|
||||||
|
|
||||||
|
while ((--(*l) >= 0) && (s[*l] != '\n'));
|
||||||
|
if (s[*l] == '\n')
|
||||||
|
s[*l] = '\0';
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
nm_utils_supplicant_request (struct wpa_ctrl *ctrl,
|
nm_utils_supplicant_request (struct wpa_ctrl *ctrl,
|
||||||
const char *format,
|
const char *format,
|
||||||
@@ -730,7 +743,10 @@ nm_utils_supplicant_request (struct wpa_ctrl *ctrl,
|
|||||||
g_free (command);
|
g_free (command);
|
||||||
response[len] = '\0';
|
response[len] = '\0';
|
||||||
#ifdef SUPPLICANT_DEBUG
|
#ifdef SUPPLICANT_DEBUG
|
||||||
nm_info ("SUP: response was '%s'", response);
|
{
|
||||||
|
response = kill_newline (response, &len);
|
||||||
|
nm_info ("SUP: response was '%s'", response);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
@@ -768,17 +784,8 @@ nm_utils_supplicant_request_with_check (struct wpa_ctrl *ctrl,
|
|||||||
response[len] = '\0';
|
response[len] = '\0';
|
||||||
#ifdef SUPPLICANT_DEBUG
|
#ifdef SUPPLICANT_DEBUG
|
||||||
{
|
{
|
||||||
gboolean newline = FALSE;
|
response = kill_newline (response, &len);
|
||||||
|
|
||||||
/* Kill the newline for the debug message */
|
|
||||||
if (response[len - 1] == '\n')
|
|
||||||
{
|
|
||||||
newline = TRUE;
|
|
||||||
response[len - 1] = '\0';
|
|
||||||
}
|
|
||||||
nm_info ("SUP: response was '%s'", response);
|
nm_info ("SUP: response was '%s'", response);
|
||||||
if (newline)
|
|
||||||
response[len - 1] = '\n';
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -788,22 +795,11 @@ nm_utils_supplicant_request_with_check (struct wpa_ctrl *ctrl,
|
|||||||
success = TRUE;
|
success = TRUE;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gboolean newline = FALSE;
|
response = kill_newline (response, &len);
|
||||||
|
|
||||||
/* Kill the newline for the debug message */
|
|
||||||
if (response[len - 1] == '\n')
|
|
||||||
{
|
|
||||||
newline = TRUE;
|
|
||||||
response[len - 1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
temp = g_strdup_printf ("%s: supplicant error for '%s'. Response: '%s'",
|
temp = g_strdup_printf ("%s: supplicant error for '%s'. Response: '%s'",
|
||||||
func, err_msg_cmd ? err_msg_cmd : command, response);
|
func, err_msg_cmd ? err_msg_cmd : command, response);
|
||||||
nm_warning_str (temp);
|
nm_warning_str (temp);
|
||||||
g_free (temp);
|
g_free (temp);
|
||||||
|
|
||||||
if (newline)
|
|
||||||
response[len - 1] = '\n';
|
|
||||||
}
|
}
|
||||||
g_free (response);
|
g_free (response);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user