[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Fix utimensat (aka unbreak cp -a)
From: |
Riku Voipio |
Subject: |
Re: [Qemu-devel] [PATCH] Fix utimensat (aka unbreak cp -a) |
Date: |
Tue, 21 Apr 2009 21:18:16 +0300 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Tue, Apr 21, 2009 at 06:38:17PM +0200, Martin Mohring wrote:
> > results in the invalid argutment error. I ll currently check which
> > syscalls are involved here.
> > the time of 1.1.1970 looks to me like a wrongly passed argument (of ==0).
no, NULL is what is supposed to be passed. try stracing a normal host
/bin/touch.
> 27374 open("/var/log/wtmp",0x20941,0666) = 3
> 27374 dup2(3,0,3,0,0,1109324328) = 0
> 27374 close(3) = 0
> 27374 utimensat(0,"(null)",(nil),0) = 0
> 27374 close(0) = 0
> 27374 open("/var/run/utmp",0x20941,0666) = 0
> 27374 utimensat(0,"(null)",(nil),0) = -1 errno=22 (Invalid argument)
It is unclear what svn revision you are using qemu, and/or if you are using
any of the patches in this thread. The patch I sent earlier, should fix
the invalid arg issue. As for the 1970 issue, try this patch.
commit 7f7e93aabde6b8f0e4a1a05537145efa9ed0156b
Author: Riku Voipio <address@hidden>
Date: Tue Apr 21 20:37:01 2009 +0300
linux-user: fix utimensat with NULL timespec
Don't try to copy timespec from user if it is NULL.
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index e19e289..0049840 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6674,17 +6674,22 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
case TARGET_NR_utimensat:
{
- struct timespec ts[2];
- target_to_host_timespec(ts, arg3);
- target_to_host_timespec(ts+1, arg3+sizeof(struct target_timespec));
+ struct timespec *tsp, ts[2];
+ if (!arg3) {
+ tsp = NULL;
+ } else {
+ target_to_host_timespec(ts, arg3);
+ target_to_host_timespec(ts+1, arg3+sizeof(struct
target_timespec));
+ tsp = ts;
+ }
if (!arg2)
- ret = get_errno(sys_utimensat(arg1, NULL, ts, arg4));
+ ret = get_errno(sys_utimensat(arg1, NULL, tsp, arg4));
else {
if (!(p = lock_user_string(arg2))) {
ret = -TARGET_EFAULT;
goto fail;
}
- ret = get_errno(sys_utimensat(arg1, path(p), ts, arg4));
+ ret = get_errno(sys_utimensat(arg1, path(p), tsp, arg4));
unlock_user(p, arg2, 0);
}
}