[PATCH] fix display of dirfd with x86 binary and x86_64 strace

Denys Vlasenko dvlasenk at redhat.com
Thu Apr 16 12:07:51 UTC 2009


On Sun, 2009-04-05 at 02:00 -0400, Mike Frysinger wrote:
> Signed-off-by: Mike Frysinger <vapier at gentoo.org>
> ---
>  file.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/file.c b/file.c
> index 614ba1e..138bac0 100644
> --- a/file.c
> +++ b/file.c
> @@ -328,13 +328,16 @@ const struct xlat open_mode_flags[] = {
>  # define AT_FDCWD                -100
>  #endif
>  
> +/* The fd is an "int", so when decoding x86 on x86_64, we need to force sign
> + * extension to get the right value.  We do this by declaring fd as int here.
> + */
>  static void
> -print_dirfd(long fd)
> +print_dirfd(int fd)
>  {
>  	if (fd == AT_FDCWD)
>  		tprintf("AT_FDCWD, ");
>  	else
> -		tprintf("%ld, ", fd);
> +		tprintf("%d, ", fd);
>  }
>  #endif

Hmm, we have similar problems with pids in wait...

Looks "obviously correct". Applied, thanks.
--
vda






More information about the Strace-devel mailing list