From: Benjamin Gwin Date: Fri, 10 Dec 2021 00:42:36 +0000 (-0800) Subject: [klibc] Fix implementation of utimes X-Git-Tag: archive/raspbian/2.0.10-4+rpi1^2^2^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e4560adac5117929a85637161db37feb3c0ba29f;p=klibc.git [klibc] Fix implementation of utimes Origin: https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=a13b588a915d3a4498bf342d85524eb7dde71594 This was not correctly initializing the timespec array before passing it on to utimensat. Tested: Built cpio and extracted an image with `cpio -im` to preserve mtime. The calls to utime now pass through the correct timestamps. Signed-off-by: Benjamin Gwin Signed-off-by: Ben Hutchings Gbp-Pq: Name klibc-fix-implementation-of-utimes.patch --- diff --git a/usr/klibc/utimes.c b/usr/klibc/utimes.c index fd378a6..ce6d2f8 100644 --- a/usr/klibc/utimes.c +++ b/usr/klibc/utimes.c @@ -10,8 +10,10 @@ int utimes(const char *file, const struct timeval tvp[2]) struct timespec ts[2]; if (tvp) { - ts->tv_sec = tvp->tv_sec; - ts->tv_nsec = tvp->tv_usec * 1000; + ts[0].tv_sec = tvp[0].tv_sec; + ts[0].tv_nsec = tvp[0].tv_usec * 1000; + ts[1].tv_sec = tvp[1].tv_sec; + ts[1].tv_nsec = tvp[1].tv_usec * 1000; } return utimensat(AT_FDCWD, file, &ts[0], 0);