From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ICHPm-0005vt-R8 for qemu-devel@nongnu.org; Sat, 21 Jul 2007 12:02:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ICHPj-0005uO-Kq for qemu-devel@nongnu.org; Sat, 21 Jul 2007 12:02:40 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ICHPi-0005uJ-UP for qemu-devel@nongnu.org; Sat, 21 Jul 2007 12:02:38 -0400 Received: from mx2.suse.de ([195.135.220.15]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ICHPi-00075l-8p for qemu-devel@nongnu.org; Sat, 21 Jul 2007 12:02:38 -0400 Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id A7E6321951 for ; Sat, 21 Jul 2007 18:02:34 +0200 (CEST) From: Andreas Schwab Subject: Re: [Qemu-devel] [PATCH] linux-user strace References: Date: Sat, 21 Jul 2007 18:02:33 +0200 In-Reply-To: (Stuart Anderson's message of "Sat\, 21 Jul 2007 09\:10\:27 -0400 \(EDT\)") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Stuart Anderson writes: > On Fri, 20 Jul 2007, Andreas Schwab wrote: > >> Stuart Anderson writes: >> >>> Index: qemu/linux-user/syscall.c >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> --- qemu.orig/linux-user/syscall.c 2007-07-19 01:42:43.000000000 -040= 0 >>> +++ qemu/linux-user/syscall.c 2007-07-19 01:43:18.000000000 -0400 >>> @@ -312,6 +312,11 @@ >>> return (unsigned long)ret >=3D (unsigned long)(-4096); >>> } >>> >>> +char *target_strerror(int err) >>> +{ >>> + return strerror(host_to_target_errno(err)); >>> +} >>> + >> >> That looks backwards. strerror surely expects a host errno value, but >> host_to_target_errno returns the errno value for the target, doesn't i= t? > > The function is called target_strerror() 8-). That's the problem. It does not return the string associated with the target errno, but something else. > It is used to display the errno string for the target, not the > host. But strerror interprets its argument as the host's errno value. If host_to_target_error maps ELOOP to TARGET_ELOOP, and TARGET_ELOOP happens have be the same value as EBADFD, the function wil return "Bad file descriptor" instead of "Too many levels of symbolic links". Andreas. --=20 Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany PGP key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED= 5 "And now for something completely different."