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 (str) {
if (!inet_pton (AF_INET6, str, &tmp_addr)) { if (!inet_pton (AF_INET6, str, &tmp_addr)) {
nm_log_warn (LOGD_DHCP6, "(%s): DHCP returned invalid address '%s'", nm_log_warn (LOGD_DHCP6, "(%s): DHCP returned invalid address '%s'",
priv->iface); priv->iface, str);
goto error; goto error;
} }

View File

@@ -235,19 +235,19 @@ nm_dhcp_manager_handle_event (DBusGProxy *proxy,
client = get_client_for_pid (manager, (GPid) temp); client = get_client_for_pid (manager, (GPid) temp);
if (client == NULL) { 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; goto out;
} }
if (strcmp (iface, nm_dhcp_client_get_iface (client))) { 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)); temp, iface, nm_dhcp_client_get_iface (client));
goto out; goto out;
} }
reason = get_option (options, "reason"); reason = get_option (options, "reason");
if (reason == NULL) { 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; goto out;
} }

View File

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

View File

@@ -701,7 +701,7 @@ process_nduseropt_rdnss (NMIP6Device *device, struct nd_opt_hdr *opt)
cur_server->expires = server.expires; cur_server->expires = server.expires;
if (server.expires > 0) { 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, device->iface, buf,
server.expires - now); server.expires - now);
break; break;
@@ -720,7 +720,7 @@ process_nduseropt_rdnss (NMIP6Device *device, struct nd_opt_hdr *opt)
if (i < device->rdnss_servers->len) if (i < device->rdnss_servers->len)
continue; 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); device->iface, buf, server.expires - now);
server.addr = *addr; server.addr = *addr;
@@ -843,7 +843,7 @@ process_nduseropt_dnssl (NMIP6Device *device, struct nd_opt_hdr *opt)
cur_domain->expires = domain.expires; cur_domain->expires = domain.expires;
if (domain.expires > 0) { 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, device->iface, domain_str,
domain.expires - now); domain.expires - now);
break; break;
@@ -862,7 +862,7 @@ process_nduseropt_dnssl (NMIP6Device *device, struct nd_opt_hdr *opt)
if (i < device->dnssl_domains->len) if (i < device->dnssl_domains->len)
continue; 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); device->iface, domain_str, domain.expires - now);
g_assert (strlen (domain_str) < sizeof (domain.domain)); 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); priv->subchan3 = g_path_get_basename (buf);
} else { } else {
nm_log_warn (LOGD_DEVICE | LOGD_HW, 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); iface, cdev_path, errno);
} }
g_free (cdev_path); 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 */ /* Do nothing if current MAC is same */
if (!memcmp (&priv->hw_addr, addr, ETH_ALEN)) { if (!memcmp (&priv->hw_addr, addr, ETH_ALEN)) {
nm_log_dbg (LOGD_DEVICE | LOGD_ETHER, "(%s): no MAC address change needed", nm_log_dbg (LOGD_DEVICE | LOGD_ETHER, "(%s): no MAC address change needed", iface);
iface, detail, mac_str);
g_free (mac_str); g_free (mac_str);
return TRUE; return TRUE;
} }

View File

@@ -809,7 +809,8 @@ supplicant_interface_release (NMDeviceWifi *self)
/* Reset the scan interval to be pretty frequent when disconnected */ /* Reset the scan interval to be pretty frequent when disconnected */
priv->scan_interval = SCAN_INTERVAL_MIN + SCAN_INTERVAL_STEP; priv->scan_interval = SCAN_INTERVAL_MIN + SCAN_INTERVAL_STEP;
nm_log_dbg (LOGD_WIFI_SCAN, "(%s): reset scanning interval to %d seconds", 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); 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 */ /* Do nothing if current MAC is same */
if (!memcmp (&priv->hw_addr, addr, ETH_ALEN)) { if (!memcmp (&priv->hw_addr, addr, ETH_ALEN)) {
nm_log_dbg (LOGD_DEVICE | LOGD_ETHER, "(%s): no MAC address change needed", nm_log_dbg (LOGD_DEVICE | LOGD_ETHER, "(%s): no MAC address change needed", iface);
iface, detail, mac_str);
g_free (mac_str); g_free (mac_str);
return TRUE; return TRUE;
} }
@@ -1677,11 +1677,8 @@ nm_device_wifi_get_mode (NMDeviceWifi *self)
break; break;
} }
} else { } else {
if (errno != ENODEV) { if (errno != ENODEV)
nm_log_warn (LOGD_HW | LOGD_WIFI, nm_log_warn (LOGD_HW | LOGD_WIFI, "(%s): error %d getting card mode", iface, errno);
"(%s): error %d getting card mode",
iface, strerror (errno));
}
} }
close (fd); close (fd);
@@ -1730,11 +1727,8 @@ nm_device_wifi_set_mode (NMDeviceWifi *self, const NM80211Mode mode)
strncpy (wrq.ifr_name, iface, IFNAMSIZ); strncpy (wrq.ifr_name, iface, IFNAMSIZ);
if (ioctl (fd, SIOCSIWMODE, &wrq) < 0) { if (ioctl (fd, SIOCSIWMODE, &wrq) < 0) {
if (errno != ENODEV) { if (errno != ENODEV)
nm_log_err (LOGD_HW | LOGD_WIFI, nm_log_err (LOGD_HW | LOGD_WIFI, "(%s): error setting mode %d", iface, mode);
"(%s): error setting mode %d",
iface, mode, strerror (errno));
}
} else } else
success = TRUE; success = TRUE;
close (fd); 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 the request should filter agents by UID, do that now */
if (req->filter_by_uid && (agent_uid != req->uid_filter)) { if (req->filter_by_uid && (agent_uid != req->uid_filter)) {
nm_log_dbg (LOGD_AGENTS, "(%s) agent ignored for secrets request %p/%s " 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), nm_secret_agent_get_description (agent),
req, req->setting_name, agent_uid, req->uid_filter); req, req->setting_name, agent_uid, req->uid_filter);
return; return;

View File

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