]> The Tcpdump Group git mirrors - tcpdump/blobdiff - smbutil.c
Makefile.in: don't remove configure and config.h.in in make distclean.
[tcpdump] / smbutil.c
index 7f609f7f3c242aa4a56d3bb9de3e181983154769..f33a323fbf2c7c4037ec7ffd8a84c62c40e25aa3 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
@@ -768,9 +768,8 @@ smb_fdata1(netdissect_options *ndo,
        case 'T':
          {
            time_t t;
-           struct tm *lt;
            const char *tstring;
-           char buffer[sizeof("Www Mmm dd hh:mm:ss yyyy\n")];
+           char buffer[sizeof("Www Mmm dd hh:mm:ss yyyyy")];
            uint32_t x;
 
            switch (atoi(fmt + 1)) {
@@ -800,16 +799,11 @@ smb_fdata1(netdissect_options *ndo,
                break;
            }
            if (t != 0) {
-               lt = localtime(&t);
-               if (lt != NULL) {
-                   strftime(buffer, sizeof(buffer), "%a %b %e %T %Y%n", lt);
-                   tstring = buffer;
-               }
-               else
-                   tstring = "(Can't convert time)\n";
+                   tstring = nd_format_time(buffer, sizeof(buffer), "%a %b %e %T %Y",
+                   localtime(&t));
            } else
-               tstring = "NULL\n";
-           ND_PRINT("%s", tstring);
+               tstring = "NULL";
+           ND_PRINT("%s\n", tstring);
            fmt++;
            while (ND_ASCII_ISDIGIT(*fmt))
                fmt++;