From 77b380c0b5b6eb4f074a4a8735d109e226512508 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Tue, 21 Jun 2016 16:30:16 -0700 Subject: [PATCH] Fix format warnings in log_message() calls --- common/os_calls.c | 10 ++++------ neutrinordp/xrdp-neutrinordp.c | 16 ++++++++-------- sesman/chansrv/chansrv.c | 3 +-- sesman/chansrv/clipboard.c | 3 ++- sesman/session.c | 2 +- vnc/vnc.c | 2 +- xrdp/xrdp_login_wnd.c | 9 +++------ xrdp/xrdp_mm.c | 14 +++++++------- xrdp/xrdp_wm.c | 2 +- 9 files changed, 28 insertions(+), 33 deletions(-) diff --git a/common/os_calls.c b/common/os_calls.c index 8ce5c25a..9a409591 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -668,7 +668,6 @@ int APP_CC g_tcp_connect(int sck, const char *address, const char *port) { int res = 0; - char errorMsg[256]; struct addrinfo p; struct addrinfo *h = (struct addrinfo *)NULL; struct addrinfo *rp = (struct addrinfo *)NULL; @@ -696,9 +695,8 @@ g_tcp_connect(int sck, const char *address, const char *port) } if (res != 0) { - snprintf(errorMsg, 255, "g_tcp_connect: getaddrinfo() failed: %s", - gai_strerror(res)); - log_message(LOG_LEVEL_ERROR, errorMsg); + log_message(LOG_LEVEL_ERROR, "g_tcp_connect: getaddrinfo() failed: %s", + gai_strerror(res)); } if (res > -1) { @@ -988,7 +986,7 @@ g_tcp_accept(int sck) { snprintf(ipAddr, 255, "A connection received from: %s port %d", inet_ntoa(s.sin_addr), ntohs(s.sin_port)); - log_message(LOG_LEVEL_INFO,ipAddr); + log_message(LOG_LEVEL_INFO, "%s", ipAddr); } return ret ; } @@ -1013,7 +1011,7 @@ g_sck_accept(int sck, char *addr, int addr_bytes, char *port, int port_bytes) { g_snprintf(ipAddr, 255, "A connection received from: %s port %d", inet_ntoa(s.sin_addr), ntohs(s.sin_port)); - log_message(LOG_LEVEL_INFO,ipAddr); + log_message(LOG_LEVEL_INFO, "%s", ipAddr); if (s.sin_family == AF_INET) { g_snprintf(addr, addr_bytes, "%s", inet_ntoa(s.sin_addr)); diff --git a/neutrinordp/xrdp-neutrinordp.c b/neutrinordp/xrdp-neutrinordp.c index 121bbe0c..b463f8a8 100644 --- a/neutrinordp/xrdp-neutrinordp.c +++ b/neutrinordp/xrdp-neutrinordp.c @@ -230,7 +230,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2, break; case 17: /* Synchronize */ - LLOGLN(11, ("Synchronized event handled : %d", param1)); + LLOGLN(11, ("Synchronized event handled : %ld", param1)); /* In some situations the Synchronize event come to early. Therefore we store this information and use it when we receive the first keyboard event @@ -246,7 +246,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2, break; case 100: /* mouse move */ - LLOGLN(12, ("mouse move %d %d", param1, param2)); + LLOGLN(12, ("mouse move %ld %ld", param1, param2)); x = param1; y = param2; flags = PTR_FLAGS_MOVE; @@ -254,7 +254,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2, break; case 101: /* left button up */ - LLOGLN(12, ("left button up %d %d", param1, param2)); + LLOGLN(12, ("left button up %ld %ld", param1, param2)); x = param1; y = param2; flags = PTR_FLAGS_BUTTON1; @@ -262,7 +262,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2, break; case 102: /* left button down */ - LLOGLN(12, ("left button down %d %d", param1, param2)); + LLOGLN(12, ("left button down %ld %ld", param1, param2)); x = param1; y = param2; flags = PTR_FLAGS_BUTTON1 | PTR_FLAGS_DOWN; @@ -270,7 +270,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2, break; case 103: /* right button up */ - LLOGLN(12, ("right button up %d %d", param1, param2)); + LLOGLN(12, ("right button up %ld %ld", param1, param2)); x = param1; y = param2; flags = PTR_FLAGS_BUTTON2; @@ -278,7 +278,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2, break; case 104: /* right button down */ - LLOGLN(12, ("right button down %d %d", param1, param2)); + LLOGLN(12, ("right button down %ld %ld", param1, param2)); x = param1; y = param2; flags = PTR_FLAGS_BUTTON2 | PTR_FLAGS_DOWN; @@ -286,7 +286,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2, break; case 105: /* middle button up */ - LLOGLN(12, ("middle button up %d %d", param1, param2)); + LLOGLN(12, ("middle button up %ld %ld", param1, param2)); x = param1; y = param2; flags = PTR_FLAGS_BUTTON3; @@ -294,7 +294,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2, break; case 106: /* middle button down */ - LLOGLN(12, ("middle button down %d %d", param1, param2)); + LLOGLN(12, ("middle button down %ld %ld", param1, param2)); x = param1; y = param2; flags = PTR_FLAGS_BUTTON3 | PTR_FLAGS_DOWN; diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c index e3d2f5d2..95224e9c 100644 --- a/sesman/chansrv/chansrv.c +++ b/sesman/chansrv/chansrv.c @@ -734,8 +734,7 @@ process_message(void) rv = process_message_channel_data_response(s); break; default: - LOGM((LOG_LEVEL_ERROR, "process_message: error in process_message ", - "unknown msg %d", id)); + LOGM((LOG_LEVEL_ERROR, "process_message: unknown msg %d", id)); break; } diff --git a/sesman/chansrv/clipboard.c b/sesman/chansrv/clipboard.c index 5f01f241..cf98b5f2 100644 --- a/sesman/chansrv/clipboard.c +++ b/sesman/chansrv/clipboard.c @@ -1920,7 +1920,8 @@ clipboard_event_selection_notify(XEvent *xevent) for (index = 0; index < n_items; index++) { atom = atoms[index]; - LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: %d %s %d", + LOGM((LOG_LEVEL_DEBUG, + "clipboard_event_selection_notify: 0x%lx %s 0x%lx", atom, get_atom_text(atom), XA_STRING)); log_debug("clipboard_event_selection_notify: 0x%lx %s", atom, get_atom_text(atom)); diff --git a/sesman/session.c b/sesman/session.c index 02bb6fa7..28e00fc9 100644 --- a/sesman/session.c +++ b/sesman/session.c @@ -963,7 +963,7 @@ session_get_bypid(int pid) if (0 == dummy) { - log_message(LOG_LEVEL_ERROR, "internal error", pid); + log_message(LOG_LEVEL_ERROR, "session_get_bypid: out of memory"); return 0; } diff --git a/vnc/vnc.c b/vnc/vnc.c index 091978e0..604fd571 100644 --- a/vnc/vnc.c +++ b/vnc/vnc.c @@ -233,7 +233,7 @@ lib_process_channel_data(struct vnc *v, int chanid, int flags, int size, } else { - log_message(LOG_LEVEL_DEBUG, "lib_process_channel_data: unknown chanid:", + log_message(LOG_LEVEL_DEBUG, "lib_process_channel_data: unknown chanid: " "%d :(v->clip_chanid) %d", chanid, v->clip_chanid); } diff --git a/xrdp/xrdp_login_wnd.c b/xrdp/xrdp_login_wnd.c index c9fca912..76fc59b0 100644 --- a/xrdp/xrdp_login_wnd.c +++ b/xrdp/xrdp_login_wnd.c @@ -273,7 +273,6 @@ xrdp_wm_parse_domain_information(char *originalDomainInfo, int comboMax, int pos; int comboxindex; char index[2]; - char debugstr[256]; /* If the first char in the domain name is '_' we use the domain name as IP*/ @@ -300,11 +299,9 @@ xrdp_wm_parse_domain_information(char *originalDomainInfo, int comboMax, /* we just accept values 0-9 (one figure) */ g_strncpy(index, &originalDomainInfo[pos + 3], 1); comboxindex = g_htoi(index); - g_snprintf(debugstr, 255, "Value of index (as char): %s " - "(converted) : %d (max) : %d", index, comboxindex, - comboMax - 1); - debugstr[255] = 0; - log_message(LOG_LEVEL_DEBUG, debugstr); + log_message(LOG_LEVEL_DEBUG, + "index value as string: %s, as int: %d, max: %d", + index, comboxindex, comboMax - 1); /* limit to max number of items in combo box */ if ((comboxindex > 0) && (comboxindex < comboMax)) { diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 94be7e4f..28923405 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -375,7 +375,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self) g_snprintf(text, 255, "error finding proc mod_init in %s, not a valid " "xrdp backend", lib); xrdp_wm_log_msg(self->wm, text); - log_message(LOG_LEVEL_ERROR,text); + log_message(LOG_LEVEL_ERROR, "%s", text); } self->mod_init = (struct xrdp_mod * ( *)(void))func; @@ -391,7 +391,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self) g_snprintf(text, 255, "error finding proc mod_exit in %s, not a valid " "xrdp backend", lib); xrdp_wm_log_msg(self->wm, text); - log_message(LOG_LEVEL_ERROR,text); + log_message(LOG_LEVEL_ERROR, "%s", text); } self->mod_exit = (int ( *)(struct xrdp_mod *))func; @@ -416,7 +416,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self) g_snprintf(text, 255, "error loading %s specified in xrdp.ini, please " "add a valid entry like lib=libxrdp-vnc.so or similar", lib); xrdp_wm_log_msg(self->wm, text); - log_message(LOG_LEVEL_ERROR,text); + log_message(LOG_LEVEL_ERROR, "%s", text); return 1; } @@ -1489,7 +1489,7 @@ access_control(char *username, char *password, char *srv) else { log_message(LOG_LEVEL_ERROR, "Corrupt reply size or " - "version from sesman: %d", size); + "version from sesman: %ld", size); } } else @@ -1909,7 +1909,7 @@ xrdp_mm_connect(struct xrdp_mm *self) getPAMError(reply, pam_error, 127)); xrdp_wm_log_msg(self->wm, replytxt); - log_message(LOG_LEVEL_INFO, replytxt); + log_message(LOG_LEVEL_INFO, "%s", replytxt); additionalError = getPAMAdditionalErrorInfo(reply, self); if (additionalError) { @@ -1970,7 +1970,7 @@ xrdp_mm_connect(struct xrdp_mm *self) g_snprintf(errstr, 255, "Failure to connect to sesman: %s port: %s", ip, port); xrdp_wm_log_msg(self->wm, errstr); - log_message(LOG_LEVEL_ERROR,errstr); + log_message(LOG_LEVEL_ERROR, "%s", errstr); trans_delete(self->sesman_trans); self->sesman_trans = 0; self->sesman_trans_up = 0; @@ -1990,7 +1990,7 @@ xrdp_mm_connect(struct xrdp_mm *self) { /* connect error */ g_snprintf(errstr, 255, "Failure to connect to: %s", ip); - log_message(LOG_LEVEL_ERROR,errstr); + log_message(LOG_LEVEL_ERROR, "%s", errstr); xrdp_wm_log_msg(self->wm, errstr); rv = 1; /* failure */ } diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index ca466197..7b9165e7 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -45,7 +45,7 @@ xrdp_wm_create(struct xrdp_process *owner, pid = g_getpid(); g_snprintf(event_name, 255, "xrdp_%8.8x_wm_login_mode_event_%8.8x", pid, owner->session_id); - log_message(LOG_LEVEL_DEBUG,event_name); + log_message(LOG_LEVEL_DEBUG, "%s", event_name); self->login_mode_event = g_create_wait_obj(event_name); self->painter = xrdp_painter_create(self, self->session); self->cache = xrdp_cache_create(self, self->session, self->client_info);