logging: fix format string/argument disagreement

Now that the logging fixes make format checking actually work, fix
the issues it brings up.
This commit is contained in:
Dan Williams
2011-03-19 12:44:14 -05:00
parent e7be98260e
commit d815cb9f33
9 changed files with 23 additions and 29 deletions

View File

@@ -1227,7 +1227,7 @@ ip6_options_to_config (NMDHCPClient *self)
if (str) {
if (!inet_pton (AF_INET6, str, &tmp_addr)) {
nm_log_warn (LOGD_DHCP6, "(%s): DHCP returned invalid address '%s'",
priv->iface);
priv->iface, str);
goto error;
}

View File

@@ -235,19 +235,19 @@ nm_dhcp_manager_handle_event (DBusGProxy *proxy,
client = get_client_for_pid (manager, (GPid) temp);
if (client == NULL) {
nm_log_warn (LOGD_DHCP, "(pid %d) unhandled DHCP event for interface %s", temp, iface);
nm_log_warn (LOGD_DHCP, "(pid %zd) unhandled DHCP event for interface %s", temp, iface);
goto out;
}
if (strcmp (iface, nm_dhcp_client_get_iface (client))) {
nm_log_warn (LOGD_DHCP, "(pid %d) received DHCP event from unexpected interface '%s' (expected '%s')",
nm_log_warn (LOGD_DHCP, "(pid %zd) received DHCP event from unexpected interface '%s' (expected '%s')",
temp, iface, nm_dhcp_client_get_iface (client));
goto out;
}
reason = get_option (options, "reason");
if (reason == NULL) {
nm_log_warn (LOGD_DHCP, "(pid %d) DHCP event didn't have a reason", temp);
nm_log_warn (LOGD_DHCP, "(pid %zd) DHCP event didn't have a reason", temp);
goto out;
}

View File

@@ -205,7 +205,7 @@ ensure_killed (gpointer data)
/* ensure the child is reaped */
nm_log_dbg (LOGD_DNS, "waiting for %s pid %d to exit", info->progname, info->pid);
waitpid (info->pid, NULL, 0);
nm_log_dbg (LOGD_DNS, "dnsmasq pid %d cleaned up", info->progname, info->pid);
nm_log_dbg (LOGD_DNS, "dnsmasq pid %d cleaned up", info->pid);
g_free (info->progname);
g_free (info);

View File

@@ -701,7 +701,7 @@ process_nduseropt_rdnss (NMIP6Device *device, struct nd_opt_hdr *opt)
cur_server->expires = server.expires;
if (server.expires > 0) {
nm_log_dbg (LOGD_IP6, "(%s): refreshing RA-provided nameserver %s (expires in %d seconds)",
nm_log_dbg (LOGD_IP6, "(%s): refreshing RA-provided nameserver %s (expires in %zd seconds)",
device->iface, buf,
server.expires - now);
break;
@@ -720,7 +720,7 @@ process_nduseropt_rdnss (NMIP6Device *device, struct nd_opt_hdr *opt)
if (i < device->rdnss_servers->len)
continue;
nm_log_dbg (LOGD_IP6, "(%s): found RA-provided nameserver %s (expires in %d seconds)",
nm_log_dbg (LOGD_IP6, "(%s): found RA-provided nameserver %s (expires in %zd seconds)",
device->iface, buf, server.expires - now);
server.addr = *addr;
@@ -843,7 +843,7 @@ process_nduseropt_dnssl (NMIP6Device *device, struct nd_opt_hdr *opt)
cur_domain->expires = domain.expires;
if (domain.expires > 0) {
nm_log_dbg (LOGD_IP6, "(%s): refreshing RA-provided domain %s (expires in %d seconds)",
nm_log_dbg (LOGD_IP6, "(%s): refreshing RA-provided domain %s (expires in %zd seconds)",
device->iface, domain_str,
domain.expires - now);
break;
@@ -862,7 +862,7 @@ process_nduseropt_dnssl (NMIP6Device *device, struct nd_opt_hdr *opt)
if (i < device->dnssl_domains->len)
continue;
nm_log_dbg (LOGD_IP6, "(%s): found RA-provided domain %s (expires in %d seconds)",
nm_log_dbg (LOGD_IP6, "(%s): found RA-provided domain %s (expires in %zd seconds)",
device->iface, domain_str, domain.expires - now);
g_assert (strlen (domain_str) < sizeof (domain.domain));

View File

@@ -358,7 +358,7 @@ _update_s390_subchannels (NMDeviceEthernet *self)
priv->subchan3 = g_path_get_basename (buf);
} else {
nm_log_warn (LOGD_DEVICE | LOGD_HW,
"(%s): failed to read cdev link '%s': %s",
"(%s): failed to read cdev link '%s': %d",
iface, cdev_path, errno);
}
g_free (cdev_path);
@@ -668,8 +668,7 @@ _set_hw_addr (NMDeviceEthernet *self, const guint8 *addr, const char *detail)
/* Do nothing if current MAC is same */
if (!memcmp (&priv->hw_addr, addr, ETH_ALEN)) {
nm_log_dbg (LOGD_DEVICE | LOGD_ETHER, "(%s): no MAC address change needed",
iface, detail, mac_str);
nm_log_dbg (LOGD_DEVICE | LOGD_ETHER, "(%s): no MAC address change needed", iface);
g_free (mac_str);
return TRUE;
}

View File

@@ -809,7 +809,8 @@ supplicant_interface_release (NMDeviceWifi *self)
/* Reset the scan interval to be pretty frequent when disconnected */
priv->scan_interval = SCAN_INTERVAL_MIN + SCAN_INTERVAL_STEP;
nm_log_dbg (LOGD_WIFI_SCAN, "(%s): reset scanning interval to %d seconds",
nm_device_get_iface (NM_DEVICE (self)));
nm_device_get_iface (NM_DEVICE (self)),
priv->scan_interval);
remove_supplicant_interface_error_handler (self);
@@ -1185,8 +1186,7 @@ _set_hw_addr (NMDeviceWifi *self, const guint8 *addr, const char *detail)
/* Do nothing if current MAC is same */
if (!memcmp (&priv->hw_addr, addr, ETH_ALEN)) {
nm_log_dbg (LOGD_DEVICE | LOGD_ETHER, "(%s): no MAC address change needed",
iface, detail, mac_str);
nm_log_dbg (LOGD_DEVICE | LOGD_ETHER, "(%s): no MAC address change needed", iface);
g_free (mac_str);
return TRUE;
}
@@ -1677,11 +1677,8 @@ nm_device_wifi_get_mode (NMDeviceWifi *self)
break;
}
} else {
if (errno != ENODEV) {
nm_log_warn (LOGD_HW | LOGD_WIFI,
"(%s): error %d getting card mode",
iface, strerror (errno));
}
if (errno != ENODEV)
nm_log_warn (LOGD_HW | LOGD_WIFI, "(%s): error %d getting card mode", iface, errno);
}
close (fd);
@@ -1730,11 +1727,8 @@ nm_device_wifi_set_mode (NMDeviceWifi *self, const NM80211Mode mode)
strncpy (wrq.ifr_name, iface, IFNAMSIZ);
if (ioctl (fd, SIOCSIWMODE, &wrq) < 0) {
if (errno != ENODEV) {
nm_log_err (LOGD_HW | LOGD_WIFI,
"(%s): error setting mode %d",
iface, mode, strerror (errno));
}
if (errno != ENODEV)
nm_log_err (LOGD_HW | LOGD_WIFI, "(%s): error setting mode %d", iface, mode);
} else
success = TRUE;
close (fd);

View File

@@ -527,7 +527,7 @@ request_add_agent (Request *req,
/* If the request should filter agents by UID, do that now */
if (req->filter_by_uid && (agent_uid != req->uid_filter)) {
nm_log_dbg (LOGD_AGENTS, "(%s) agent ignored for secrets request %p/%s "
"(uid %ld not required %ld)",
"(uid %d not required %ld)",
nm_secret_agent_get_description (agent),
req, req->setting_name, agent_uid, req->uid_filter);
return;

View File

@@ -371,6 +371,7 @@ try_add_service (NMVPNManager *self, const char *namefile)
service = nm_vpn_service_new (namefile, &error);
if (!service) {
nm_log_warn (LOGD_VPN, "failed to load VPN service file %s: (%d) %s",
namefile,
error ? error->code : -1,
error && error->message ? error->message : "(unknown)");
g_clear_error (&error);
@@ -379,7 +380,7 @@ try_add_service (NMVPNManager *self, const char *namefile)
service_name = nm_vpn_service_get_dbus_service (service);
g_hash_table_insert (priv->services, (char *) service_name, service);
nm_log_info (LOGD_VPN, "VPN: loaded %s", service_name, service);
nm_log_info (LOGD_VPN, "VPN: loaded %s", service_name);
}
static void
@@ -411,7 +412,7 @@ vpn_dir_changed (GFileMonitor *monitor,
/* Stop active VPN connections and destroy the service */
nm_vpn_service_connections_stop (service, TRUE,
NM_VPN_CONNECTION_STATE_REASON_SERVICE_STOPPED);
nm_log_info (LOGD_VPN, "VPN: unloaded %s", service_name, service);
nm_log_info (LOGD_VPN, "VPN: unloaded %s", service_name);
g_hash_table_remove (priv->services, service_name);
}
break;

View File

@@ -447,7 +447,7 @@ wpa_ie_data * wpa_parse_wpa_ie(const u8 *wpa_ie, size_t wpa_ie_len)
nm_log_dbg (LOGD_WIFI, " key mgmt 0x%X", data->key_mgmt);
nm_log_dbg (LOGD_WIFI, " capabilities 0x%X", data->capabilities);
nm_log_dbg (LOGD_WIFI, " # pmkid 0x%X", data->num_pmkid);
nm_log_dbg (LOGD_WIFI, "");
nm_log_dbg (LOGD_WIFI, " ");
}
return data;