tech-userlevel archive

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

Re: [RFC] inetd(8) changes proposal

On Wed 31 May 2023 at 00:18:26 +0700, Robert Elz wrote:
>     Date:        Tue, 30 May 2023 16:11:55 +0200
>     From:
>     Message-ID:  <>
>   | -c	check a config file (and does not execute). Returns 0 on success and
>   | 	ENOENT or EINVAL on error.
> If you mean what that seems to say, then no.  The check only part is fine,
> but functions can return ENOENT or EINVAL (or can return -1, or NULL, or
> something with one of those in errno) - programs do not exit with those
> values as the status (as their values aren't specified, it is possible
> that ENOENT%256 (or ENOENT&0xFF if you prefer) == 0.
> You can either just exit with status 1, or exit 1 for file open failed
> (which covers a whole range of errno values, not just ENOENT), and 2
> for invalid contents if you prefer.   But never use errno values as an
> exit parameter.

There is <sysexits.h> which defines "Exit status codes for system
programs." EX_DATAERR could be appropriate for an invalid config file.

___ Olaf 'Rhialto' Seibert                            <rhialto/at/>
\X/ There is no AI. There is just someone else's work.           --I. Rose

Attachment: signature.asc
Description: PGP signature

Home | Main Index | Thread Index | Old Index