]> granicus.if.org Git - strace/commitdiff
print_timespec.c: use xsprintf instead of snprintf
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 7 Jan 2018 00:05:42 +0000 (00:05 +0000)
* print_timespec.c: Include "xstring.h".
(sprint_timespec): Replace snprintf with xsprintf.

print_timespec.c

index c8ab5b7bb68bbaf485e31ea3434edca34bffbcf5..30b6bba38c3e96731949b4bd2d7b656204a0e60d 100644 (file)
@@ -34,6 +34,8 @@ typedef struct timespec timespec_t;
 
 #include MPERS_DEFS
 
+#include "xstring.h"
+
 #ifndef UTIME_NOW
 # define UTIME_NOW ((1l << 30) - 1l)
 #endif
@@ -125,9 +127,9 @@ MPERS_PRINTER_DECL(const char *, sprint_timespec,
                strcpy(buf, "NULL");
        } else if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)) ||
                   umove(tcp, addr, &t)) {
-               snprintf(buf, sizeof(buf), "%#" PRI_klx, addr);
+               xsprintf(buf, "%#" PRI_klx, addr);
        } else {
-               snprintf(buf, sizeof(buf), timespec_fmt,
+               xsprintf(buf, timespec_fmt,
                         (long long) t.tv_sec,
                         zero_extend_signed_to_ull(t.tv_nsec));
        }