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

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

 



Hi Guy,

On 2/20/23 17:08, Guy Shefy wrote:
 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>

Patch applied.  Thanks very much for the example program!

Alex

---
  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 ():

--
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[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