aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorUlrich Hecht <uli@suse.de>2009-07-24 19:10:32 +0200
committerRiku Voipio <riku.voipio@iki.fi>2009-08-25 17:15:35 +0300
commit12727917db45aebb809e4b09c51e883c09a6366f (patch)
tree135c4d7d76aefed61c7a8f01933682d74f27d290 /linux-user
parente72d2cc781f335474fe07234051b64ec314714f4 (diff)
downloadqemu-12727917db45aebb809e4b09c51e883c09a6366f.zip
qemu-12727917db45aebb809e4b09c51e883c09a6366f.tar.gz
qemu-12727917db45aebb809e4b09c51e883c09a6366f.tar.bz2
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> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7eb09fa..25b95ea 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5529,6 +5529,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);