Commit acc3025d authored by Jiří Klimeš's avatar Jiří Klimeš

core: socket() returns -1 on failure

parent 17bc5867
......@@ -423,7 +423,7 @@ create_socket_with_request (NMDevice *self, struct iwreq *req)
g_return_val_if_fail (self != NULL, -1);
sk = socket (AF_INET, SOCK_DGRAM, 0);
if (!sk) {
if (sk == -1) {
nm_log_err (LOGD_OLPC_MESH, "Couldn't create socket: %d.", errno);
return -1;
}
......@@ -510,7 +510,7 @@ nm_device_olpc_mesh_set_ssid (NMDeviceOlpcMesh *self, const GByteArray * ssid)
g_return_if_fail (self != NULL);
sk = socket (AF_INET, SOCK_DGRAM, 0);
if (!sk) {
if (sk == -1) {
nm_log_err (LOGD_OLPC_MESH, "Couldn't create socket: %d.", errno);
return;
}
......
......@@ -1831,7 +1831,7 @@ nm_device_wifi_get_ssid (NMDeviceWifi *self)
priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
sk = socket (AF_INET, SOCK_DGRAM, 0);
if (!sk) {
if (sk == -1) {
nm_log_err (LOGD_HW, "couldn't create socket: %d.", errno);
return NULL;
}
......
......@@ -384,6 +384,9 @@ is_wireless (GUdevDevice *device)
g_assert (ifname);
fd = socket (PF_INET, SOCK_DGRAM, 0);
if (fd == -1)
return FALSE;
strncpy (iwr.ifr_ifrn.ifrn_name, ifname, IFNAMSIZ);
path = g_udev_device_get_sysfs_path (device);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment