No reason to format to a string buffer and then just print that string, use vsyslog and vfprintf directly instead. Signed-off-by: Jason Gunthorpe <jgunthorpe@xxxxxxxxxxxxxxxxxxxx> --- srp_daemon/srp_daemon.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c index f0dfe260945574..a75f3af085cbde 100644 --- a/srp_daemon/srp_daemon.c +++ b/srp_daemon/srp_daemon.c @@ -295,22 +295,17 @@ void pr_debug(const char *fmt, ...) void pr_err(const char *fmt, ...) { va_list args; - int pos; - char str[1000]; va_start(args, fmt); - pos = vsnprintf(str, sizeof(str), fmt, args); - va_end(args); - if (pos >= sizeof(str)) - str[sizeof(str) - 1] = '\0'; switch (s_log_dest) { case log_to_syslog: - syslog(LOG_DAEMON | LOG_ERR, "%s", str); + vsyslog(LOG_DAEMON | LOG_ERR, fmt, args); break; case log_to_stderr: - fprintf(stderr, "%s", str); + vfprintf(stderr, fmt, args); break; } + va_end(args); } static int check_not_equal_str(const char *dir_name, const char *attr, -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html