099a9a83f6
Update to v1.4.0 final OBS-URL: https://build.opensuse.org/request/show/155597 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=128
39 lines
1.4 KiB
Diff
39 lines
1.4 KiB
Diff
From 7626ebe1e2a0c67547d38f0ee8c483442d46c244 Mon Sep 17 00:00:00 2001
|
|
From: Alexander Graf <agraf@suse.de>
|
|
Date: Thu, 13 Dec 2012 14:29:22 +0100
|
|
Subject: [PATCH] linux-user: lseek: explicitly cast end offsets to signed
|
|
|
|
When doing lseek, SEEK_END indicates that the offset is a signed variable
|
|
that is usually negative, while and other SEEK indicates that it's unsigned.
|
|
|
|
When converting from 32bit to 64bit parameters, we need to take this into
|
|
account and enable SEEK_END to be negative, while other SEEKs usually indicate
|
|
absolute position which we need to maintain as unsigned.
|
|
|
|
Signed-off-by: Alexander Graf <agraf@suse.de>
|
|
---
|
|
linux-user/syscall.c | 9 +++++++--
|
|
1 Datei geändert, 7 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)
|
|
|
|
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
|
|
index 5e6ac06..bed73f3 100644
|
|
--- a/linux-user/syscall.c
|
|
+++ b/linux-user/syscall.c
|
|
@@ -5628,9 +5628,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1,
|
|
case TARGET_NR_oldstat:
|
|
goto unimplemented;
|
|
#endif
|
|
- case TARGET_NR_lseek:
|
|
- ret = get_errno(lseek(arg1, arg2, arg3));
|
|
+ case TARGET_NR_lseek: {
|
|
+ off_t off = arg2;
|
|
+ if (arg3 == SEEK_END) {
|
|
+ off = (abi_long)arg2;
|
|
+ }
|
|
+ ret = get_errno(lseek(arg1, off, arg3));
|
|
break;
|
|
+ }
|
|
#if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA)
|
|
/* Alpha specific */
|
|
case TARGET_NR_getxpid:
|