SHA256
1
0
forked from pool/qemu
qemu/0032-linux-user-lseek-explicitly-cast-no.patch
Olaf Hering 7adb207e17 Accepting request 383004 from home:olh:qemu
- Update to v2.6.0-rc0: See http://wiki.qemu-project.org/ChangeLog/2.6
* Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.6
* Accept every size in DISCARD request from a guest (bsc#964427)
  0039-block-split-large-discard-requests-.patch
* Recognize libxl flag to disable flush in block device (bsc#879425)
  0040-xen_disk-Add-suse-specific-flush-di.patch
* Use correct flag for crypto tests
  0041-tests-Use-correct-config-param-for-.patch
* Fix build on powerpc:
  0042-build-link-with-libatomic-on-powerp.patch
* Patches dropped (upstreamed):
  seabios_checkrom_typo.patch
  seabios_avoid_smbios_signature_string.patch

OBS-URL: https://build.opensuse.org/request/show/383004
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=289
2016-04-05 13:18:15 +00:00

39 lines
1.4 KiB
Diff

From 559e01a1b23a661ba9bf9da313018059e06d727a 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 non-set offsets to signed
When doing lseek, SEEK_SET indicates that the offset is an unsigned variable.
Other seek types have parameters that can be negative.
When converting from 32bit to 64bit parameters, we need to take this into
account and enable SEEK_END and SEEK_CUR to be negative, while SEEK_SET stays
absolute positioned which we need to maintain as unsigned.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 2048082..00c075d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6320,9 +6320,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_SET) {
+ 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: