Andrew Geissler | 72956ed | 2021-01-08 16:11:14 -0600 | [diff] [blame] | 1 | From 9de23a9199d26e64ab6b5be2bb74f260200b2dc5 Mon Sep 17 00:00:00 2001 |
| 2 | From: matt335672 <30179339+matt335672@users.noreply.github.com> |
| 3 | Date: Fri, 21 Aug 2020 12:20:31 +0100 |
| 4 | Subject: [PATCH] Fixed compiler warnings about snprintf truncations |
| 5 | |
| 6 | Upstream-Status: Backport [https://github.com/neutrinolabs/xrdp/pull/1659] |
| 7 | --- |
| 8 | common/log.c | 4 +--- |
| 9 | 1 file changed, 1 insertion(+), 3 deletions(-) |
| 10 | |
| 11 | diff --git a/common/log.c b/common/log.c |
| 12 | index 4a0bd2f3..8686789d 100644 |
| 13 | --- a/common/log.c |
| 14 | +++ b/common/log.c |
| 15 | @@ -555,9 +555,7 @@ log_message(const enum logLevels lvl, const char *msg, ...) |
| 16 | now_t = time(&now_t); |
| 17 | now = localtime(&now_t); |
| 18 | |
| 19 | - snprintf(buff, 21, "[%.4d%.2d%.2d-%.2d:%.2d:%.2d] ", now->tm_year + 1900, |
| 20 | - now->tm_mon + 1, now->tm_mday, now->tm_hour, now->tm_min, |
| 21 | - now->tm_sec); |
| 22 | + strftime(buff, 21, "[%Y%m%d-%H:%M:%S] ", now); |
| 23 | |
| 24 | internal_log_lvl2str(lvl, buff + 20); |
| 25 | |
| 26 | -- |
| 27 | 2.29.2 |
| 28 | |