diff mbox

getgrent.3: Add ENOENT to error list.

Message ID 54105ED1.5020206@redhat.com
State New
Headers show

Commit Message

Carlos O'Donell Sept. 10, 2014, 2:23 p.m. UTC
Michael,

It's possible to get ENOENT returned from getgrent
if the backend, for example say SSSD, isn't configured
or the daemon isn't running. The same can be said of any
of the NSS backend.

As POSIX does not list ENOENT, we can list it ourselves
and define it how we like.

I don't know how you handle errno values that are glibc
specific, but here is the patch that enhances getgrent
to make users aware of what ENOENT is intended to mean
from glibc.

Patch against master. Pleas apply.

---

Cheers,
Carlos.

Comments

Siddhesh Poyarekar Sept. 10, 2014, 2:53 p.m. UTC | #1
On Wed, Sep 10, 2014 at 10:23:13AM -0400, Carlos O'Donell wrote:
> It's possible to get ENOENT returned from getgrent
> if the backend, for example say SSSD, isn't configured
> or the daemon isn't running. The same can be said of any
> of the NSS backend.

The daemon not running is internally a NSS_STATUS_TRYAGAIN +
EAGAIN[1], i.e. that is what the sssd nss plugin should return to
glibc.  glibc then should return that as a NOTFOUND, which for
getgrent is a NULL return without errno set.  I don't see why ENOENT
is necessary.

Siddhesh

[1] http://www.gnu.org/software/libc/manual/html_node/NSS-Modules-Interface.html
Michael Kerrisk \(man-pages\) Sept. 14, 2014, 4:09 p.m. UTC | #2
Hi Carlos,

On 09/10/2014 07:23 AM, Carlos O'Donell wrote:
> Michael,
> 
> It's possible to get ENOENT returned from getgrent
> if the backend, for example say SSSD, isn't configured
> or the daemon isn't running. The same can be said of any
> of the NSS backend.
> 
> As POSIX does not list ENOENT, we can list it ourselves
> and define it how we like.
> 
> I don't know how you handle errno values that are glibc
> specific, but here is the patch that enhances getgrent
> to make users aware of what ENOENT is intended to mean
> from glibc.

Thanks. I've applied. Are similar fixes also required for, 
say, getpwent.3, getspent.3, and perhaps other pages 
(e.g., putgrent)?

Cheers,

Michael


> Patch against master. Pleas apply.
> 
> diff --git a/man3/getgrent.3 b/man3/getgrent.3
> index f49c746..02f26bd 100644
> --- a/man3/getgrent.3
> +++ b/man3/getgrent.3
> @@ -141,6 +141,11 @@ The calling process already has too many open files.
>  .B ENFILE
>  Too many open files in the system.
>  .TP
> +.\" not in POSIX
> +.B ENOENT
> +A necessary input file cannot be found.
> +For NSS backends in glibc this indicates the backend is not correctly configured.
> +.TP
>  .B ENOMEM
>  .\" not in POSIX
>  Insufficient memory to allocate
> ---
> 
> Cheers,
> Carlos.
> .
>
diff mbox

Patch

diff --git a/man3/getgrent.3 b/man3/getgrent.3
index f49c746..02f26bd 100644
--- a/man3/getgrent.3
+++ b/man3/getgrent.3
@@ -141,6 +141,11 @@  The calling process already has too many open files.
 .B ENFILE
 Too many open files in the system.
 .TP
+.\" not in POSIX
+.B ENOENT
+A necessary input file cannot be found.
+For NSS backends in glibc this indicates the backend is not correctly configured.
+.TP
 .B ENOMEM
 .\" not in POSIX
 Insufficient memory to allocate