-/* $OpenBSD: stat.c,v 1.23 2018/09/18 15:14:06 tb Exp $ */
+/* $OpenBSD: stat.c,v 1.24 2023/08/06 19:33:54 guenther Exp $ */
/* $NetBSD: stat.c,v 1.19 2004/06/20 22:20:16 jmc Exp $ */
/*
}
small = (sizeof(secs) == 4);
data = secs;
- small = 1;
tm = localtime(&secs);
(void)strftime(path, sizeof(path), timefmt, tm);
sdata = path;
(void)snprintf(tmp, sizeof(tmp), "%d", size);
(void)strlcat(lfmt, tmp, sizeof(lfmt));
}
- (void)strlcat(lfmt, "d", sizeof(lfmt));
- n = snprintf(buf, blen, lfmt, secs);
+ (void)strlcat(lfmt, "lld", sizeof(lfmt));
+ n = snprintf(buf, blen, lfmt, (long long)secs);
return (n >= blen ? blen : n);
}
(void)snprintf(tmp, sizeof(tmp), "%d", size);
(void)strlcat(lfmt, tmp, sizeof(lfmt));
}
- (void)strlcat(lfmt, "d", sizeof(lfmt));
+ (void)strlcat(lfmt, "lld", sizeof(lfmt));
/*
* The stuff after the decimal point always needs zero
* We can "print" at most nine digits of precision. The
* rest we will pad on at the end.
*/
- (void)snprintf(tmp, sizeof(tmp), "%dd", prec > 9 ? 9 : prec);
+ (void)snprintf(tmp, sizeof(tmp), "%dld", prec > 9 ? 9 : prec);
(void)strlcat(lfmt, tmp, sizeof(lfmt));
/*
* Use the format, and then tack on any zeroes that
* might be required to make up the requested precision.
*/
- l = snprintf(buf, blen, lfmt, secs, nsecs);
+ l = snprintf(buf, blen, lfmt, (long long)secs, nsecs);
if (l >= blen)
return (l);
for (; prec > 9 && l < blen; prec--, l++)