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?= <p...@draigbrady.com> > 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
signature.asc
Description: OpenPGP digital signature