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

* Re: [PATCH] man/man3/posix_spawn.3: Check for executable name in example
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Alejandro Colomar @ 2025-08-19 10:49 UTC (permalink / raw)
  To: dave; +Cc: linux-man

[-- Attachment #1: Type: text/plain, Size: 1102 bytes --]

Hi Dave,

On Mon, Aug 18, 2025 at 11:59:10PM +0100, dave@treblig.org wrote:
> 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>

Thanks!  I've applied the patch.


Have a lovely day!
Alex

> ---
>  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
> 
> 

-- 
<https://www.alejandro-colomar.es/>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[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