Skip to contentSkip to conversation

man/man3/posix_spawn.3: Check for executable name in example

PATCH In review [email protected] 2 participants 2 messages Aug 18, 2025 – Aug 19, 2025 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 man/man3/posix_spawn.3: Check for executable name in example

From: "Dr. David Alan Gilbert" <[email protected]>

Make the example check for an executable name on the command line rather than segfaulting in the child.

---
 man/man3/posix_spawn.3 | 5 +++++
 1 file changed, 5 insertions(+)
man/man3/posix_spawn.3 +5 -0
index 3aaf3873e..0d238f51c 100644
@@ -730,6 +730,11 @@ .SS Program source
             break;
         }
     }
+\&
+    if (!argv[optind]) {
+        fprintf(stderr, "Usage: %s [\-cs] executable [args]\[rs]n", argv[0]);
+        exit(EXIT_FAILURE);
+    }
 \&
     /* Spawn the child. The name of the program to execute and the
        command\-line arguments are taken from the command\-line arguments
Signature · 1 line
2.50.1
#1 lore raw

Hi Dave,

Quoted 6 lines · On Mon, Aug 18, 2025 at 11:59:10PM +0100, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

Make the example check for an executable name on the command line rather than segfaulting in the child.

Thanks! I've applied the patch.

Have a lovely day!
Alex

Quoted 24 lines
---
 man/man3/posix_spawn.3 | 5 +++++
 1 file changed, 5 insertions(+)
man/man3/posix_spawn.3 +5 -0
index 3aaf3873e..0d238f51c 100644
@@ -730,6 +730,11 @@ .SS Program source
             break;
         }
     }
+\&
+    if (!argv[optind]) {
+        fprintf(stderr, "Usage: %s [\-cs] executable [args]\[rs]n", argv[0]);
+        exit(EXIT_FAILURE);
+    }
 \&
     /* Spawn the child. The name of the program to execute and the
        command\-line arguments are taken from the command\-line arguments
Signature · 1 line
2.50.1
Signature · 1 line
<https://www.alejandro-colomar.es/>