virtualization/app-emulation/qemu/files/0.11.0/0032-linux-user-zero-fstat-buffer-to-initialize-nsec-fie.patch

32 lines
1.2 KiB
Diff
Raw Normal View History

From 50a2b3b61b897ada12c267538e9f65578c256880 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Fri, 10 Jul 2009 16:43:26 +0200
Subject: [PATCH 32/33] linux-user: zero fstat buffer to initialize nsec fields
The fstat implementation does not initialize the nanosecond fields in the
stat buffer; this caused funny values to turn up there, preventing, for
instance, cp -p from preserving timestamps because utimensat rejected
the out-of-bounds nanosecond values. Resetting the entire structure
to zero fixes that.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/syscall.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index c4b7001..ef76537 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5552,6 +5552,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
if (!lock_user_struct(VERIFY_WRITE, target_st, arg2, 0))
goto efault;
+ memset(target_st, 0, sizeof(*target_st));
__put_user(st.st_dev, &target_st->st_dev);
__put_user(st.st_ino, &target_st->st_ino);
__put_user(st.st_mode, &target_st->st_mode);
--
1.6.2.1