bug-gnulib
[Top][All Lists]
Advanced

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

Re: test-getlogin false failure in non login shells


From: Eric Blake
Subject: Re: test-getlogin false failure in non login shells
Date: Thu, 22 May 2014 10:40:59 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 05/22/2014 10:25 AM, Pádraig Brady wrote:
> Drats sorry. This shows up when the ttyname_r module is also used,
> thus setting HAVE_TTYNAME (which I forgot to do), thus triggering
> the invalid test code.
> 
> I've fixed this up in the attached and pushed.
> 
> sorry for the trouble.
> 
> Pádraig.
> 
> 
> getlogin_r-test-fix.patch
> 
> 
>>From 11167af9538fb8526d30784ae048d45d1abc83b2 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?P=C3=A1draig=20Brady?= <address@hidden>
> Date: Thu, 22 May 2014 17:09:49 +0100
> Subject: [PATCH] getlogin_r-tests: fix various issues in recent change
> 
> * tests/test-getlogin_r.c: Include required headers that were
> missed in recent commit eec20b4e.
> Also consistently check the errno rather than the return value from
> getlogin_r as POSIX only specifies that non zero is returned on error.

Umm, you're misreading that.  POSIX requires:

getlogin() fails => errno is set to error code
getlogin_r() fails => return value is the error code, errno is unspecified


>  
>        /* getlogin_r() fails when stdin is not connected to a tty.  */
> -      ASSERT (err == ENOTTY
> +      ASSERT (errno == ENOTTY
>                || errno == EINVAL /* seen on Linux/SPARC */
>                || errno == ENXIO

So this should actually be checking 'err', not 'errno', for all three
instances.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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