Re: [PATCH] setpgid.2: ERRORS: add EPERM for nonexisting process group

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 961b64515b805caadb5a77e3592eb3e883c57e0d Mon Sep 17 00:00:00 2001
From: Guy Shefy <guyshefyb@xxxxxxxxx>
Date: Mon, 20 Feb 2023 17:54:40 +0200
Subject: [PATCH] setpgid.2: ERRORS: add EPERM for nonexisting process group

found using test program:

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main() {
	pid_t pid_a = fork();
	if (!pid_a) {
		// pid_a is not a valid process group
		sleep(1); // stay alive
		return 0;
	}
	if (!fork()) {
		setpgid(0, pid_a);
		perror("setpgid");
		return 0;
	}
	sleep(1); // stay alive
	return 0;
}

Signed-off-by: Guy Shefy <guyshefyb@xxxxxxxxx>
---
 man2/setpgid.2 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/man2/setpgid.2 b/man2/setpgid.2
index 52c5bd5fc..0b0182eb9 100644
--- a/man2/setpgid.2
+++ b/man2/setpgid.2
@@ -214,6 +214,11 @@ a session leader
 .RB ( setpgid (),
 .BR setpgrp ()).
 .TP
+.B EPERM
+The target process group does not exists.
+.RB ( setpgid (),
+.BR setpgrp ()).
+.TP
 .B ESRCH
 For
 .BR getpgid ():
-- 
2.34.1

On Mon, Feb 20, 2023 at 06:01:48PM +0200, Guy Shefy wrote:
> >From d2da0c74521195f4211bdc25089bbd6b420010c0 Mon Sep 17 00:00:00 2001
> From: Guy Shefy <guyshefyb@xxxxxxxxx>
> Date: Mon, 20 Feb 2023 17:54:40 +0200
> Subject: [PATCH] setpgid.2: ERRORS: add EPERM for nonexisting process group
> 
> found using test program:
> 
> int main() {
> 	pid_t pid_a = fork();
> 	if (!pid_a) {
> 		// pid_a is not a valid process group
> 		sleep(1); // stay alive
> 		return 0;
> 	}
> 	if (!fork()) {
> 		setpgid(0, pid_a);
> 		perror("setpgid");
> 		return 0;
> 	}
> 	sleep(1); // stay alive
> 	return 0;
> }
> 
> Signed-off-by: Guy Shefy <guyshefyb@xxxxxxxxx>
> ---
>  man2/setpgid.2 | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/man2/setpgid.2 b/man2/setpgid.2
> index 52c5bd5fc..0b0182eb9 100644
> --- a/man2/setpgid.2
> +++ b/man2/setpgid.2
> @@ -214,6 +214,11 @@ a session leader
>  .RB ( setpgid (),
>  .BR setpgrp ()).
>  .TP
> +.B EPERM
> +The target process group does not exists.
> +.RB ( setpgid (),
> +.BR setpgrp ()).
> +.TP
>  .B ESRCH
>  For
>  .BR getpgid ():
> -- 
> 2.34.1
> 
> On Mon, Feb 20, 2023 at 04:51:53PM +0100, Alex Colomar wrote:
> > Hello Guy,
> > 
> > On 2/20/23 16:50, Guy Shefy wrote:
> > > Signed-off-by: Guy Shefy <guyshefyb@xxxxxxxxx>
> > > ---
> > >   man2/setpgid.2 | 5 +++++
> > >   1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/man2/setpgid.2 b/man2/setpgid.2
> > > index 52c5bd5fc..0b0182eb9 100644
> > > --- a/man2/setpgid.2
> > > +++ b/man2/setpgid.2
> > > @@ -214,6 +214,11 @@ a session leader
> > >   .RB ( setpgid (),
> > >   .BR setpgrp ()).
> > >   .TP
> > > +.B EPERM
> > > +The target process group does not exists.
> > > +.RB ( setpgid (),
> > > +.BR setpgrp ()).
> > > +.TP
> > 
> > Could you please document how you found this in the commit message?
> > 
> > Thanks,
> > 
> > Alex
> > 
> > >   .B ESRCH
> > >   For
> > >   .BR getpgid ():
> > 
> > -- 
> > <http://www.alejandro-colomar.es/>
> > GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
> > 
> 
> 
> 



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux