On Wed, Oct 25, 2023 at 9:47 PM Gabriel Ravier <gabrav...@gmail.com> wrote:
> Isn't this a similar situation to e.g. `getuid`/`geteuid`/etc. failures

Not similar enough to draw a conclusion. Unlike system(), those functions
are not part of the language defined by ISO C, but the operating system
interface defined by POSIX. How operating systems are designed is outside
the scope of ISO C; it can not require that system(NULL) perform additional
checks to determine if the command processor is currently available, as it
might require the user to enter his credentials, have a working internet
connection, etc. And an environment where the command shell is unavailable
is not supported by POSIX, so system(NULL) always returns non-zero.

I don't think POSIX allows (or should allow) system(NULL) to return 0, but
feel free to request clarification.


-- 
Oğuz
  • system(NULL) overly r... enh via austin-group-l at The Open Group
    • Re: system(NULL)... Oğuz via austin-group-l at The Open Group
      • Re: system(N... Jonathan Wakely via austin-group-l at The Open Group
        • Re: syst... Oğuz via austin-group-l at The Open Group
          • Re: ... Gabriel Ravier via austin-group-l at The Open Group
            • ... enh via austin-group-l at The Open Group
              • ... Gabriel Ravier via austin-group-l at The Open Group
            • ... Oğuz via austin-group-l at The Open Group
              • ... Gabriel Ravier via austin-group-l at The Open Group
                • ... Oğuz via austin-group-l at The Open Group
    • Re: system(NULL)... Robert Elz via austin-group-l at The Open Group

Reply via email to