Linux Manual Pages development
 help / color / mirror / Atom feed
* [PATCH] man/man3/posix_spawn.3: Check for executable name in example
@ 2025-08-18 22:59 dave
  2025-08-19 10:49 ` Alejandro Colomar
  0 siblings, 1 reply; 2+ messages in thread
From: dave @ 2025-08-18 22:59 UTC (permalink / raw)
  To: alx; +Cc: linux-man, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <dave@treblig.org>

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

Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
---
 man/man3/posix_spawn.3 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/man/man3/posix_spawn.3 b/man/man3/posix_spawn.3
index 3aaf3873e..0d238f51c 100644
--- a/man/man3/posix_spawn.3
+++ b/man/man3/posix_spawn.3
@@ -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
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-19 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-18 22:59 [PATCH] man/man3/posix_spawn.3: Check for executable name in example dave
2025-08-19 10:49 ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox