qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] linux-user strace


From: Andreas Schwab
Subject: Re: [Qemu-devel] [PATCH] linux-user strace
Date: Sat, 21 Jul 2007 18:02:33 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux)

Stuart Anderson <address@hidden> writes:

> On Fri, 20 Jul 2007, Andreas Schwab wrote:
>
>> Stuart Anderson <address@hidden> writes:
>>
>>> Index: qemu/linux-user/syscall.c
>>> ===================================================================
>>> --- qemu.orig/linux-user/syscall.c  2007-07-19 01:42:43.000000000 -0400
>>> +++ qemu/linux-user/syscall.c       2007-07-19 01:43:18.000000000 -0400
>>> @@ -312,6 +312,11 @@
>>>      return (unsigned long)ret >= (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 it?
>
> 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.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]