Page MenuHomeFreeBSD

system(3): Fix null case
ClosedPublic

Authored by des on Feb 24 2026, 1:44 PM.
Tags
None
Referenced Files
F159692428: D55484.diff
Wed, Jun 17, 3:10 AM
Unknown Object (File)
Sun, Jun 14, 6:14 AM
Unknown Object (File)
Thu, Jun 11, 3:38 AM
Unknown Object (File)
Tue, Jun 9, 4:47 PM
Unknown Object (File)
Tue, Jun 9, 12:06 PM
Unknown Object (File)
Tue, Jun 9, 7:27 AM
Unknown Object (File)
Tue, Jun 9, 12:32 AM
Unknown Object (File)
Sun, Jun 7, 7:00 PM
Subscribers

Details

Summary

Our manual page states that if given a null pointer, system() returns
non-zero if the shell is available and zero if it is not. This is
consistent with the C standard's description of system(), but it is not
what we actually do. What we actually do is always return non-zero, as
required by POSIX.

As the POSIX rationale explains, implementing the logic required by the
C standard does not violate POSIX, since a conforming system always has
a shell, therefore the logic will always return non-zero.

Since our libc is commonly used in non-conforming situations such as
chroots or thin jails, we should implement the full logic required by
the C standard.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 70954
Build 67837: arc lint + arc unit