Commit f72e8ff4a698c13c69b9f3f06a56b60ca5af3a78
1 parent
b06eddd3
utime fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@780 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
9 additions
and
4 deletions
linux-user/syscall.c
@@ -1729,11 +1729,16 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | @@ -1729,11 +1729,16 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | ||
1729 | break; | 1729 | break; |
1730 | case TARGET_NR_utime: | 1730 | case TARGET_NR_utime: |
1731 | { | 1731 | { |
1732 | - struct utimbuf tbuf; | 1732 | + struct utimbuf tbuf, *tbuf1; |
1733 | struct target_utimbuf *target_tbuf = (void *)arg2; | 1733 | struct target_utimbuf *target_tbuf = (void *)arg2; |
1734 | - tbuf.actime = tswapl(target_tbuf->actime); | ||
1735 | - tbuf.modtime = tswapl(target_tbuf->modtime); | ||
1736 | - ret = get_errno(utime((const char *)arg1, &tbuf)); | 1734 | + if (target_tbuf) { |
1735 | + get_user(tbuf.actime, &target_tbuf->actime); | ||
1736 | + get_user(tbuf.modtime, &target_tbuf->modtime); | ||
1737 | + tbuf1 = &tbuf; | ||
1738 | + } else { | ||
1739 | + tbuf1 = NULL; | ||
1740 | + } | ||
1741 | + ret = get_errno(utime((const char *)arg1, tbuf1)); | ||
1737 | } | 1742 | } |
1738 | break; | 1743 | break; |
1739 | #ifdef TARGET_NR_stty | 1744 | #ifdef TARGET_NR_stty |