Skip to content

Commit 257a078

Browse files
committed
Prefer POSIX getpgrp() to getpgid(0).
We use getpgrp() in most place so prefer it for consistency with the rest of the code base.
1 parent 8feff96 commit 257a078

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/util/getentropy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ getentropy_fallback(void *buf, size_t len)
470470
HX((pid = getpid()) == -1, pid);
471471
HX((pid = getsid(pid)) == -1, pid);
472472
HX((pid = getppid()) == -1, pid);
473-
HX((pid = getpgid(0)) == -1, pid);
473+
HX((pid = getpgrp()) == -1, pid);
474474
HX((e = getpriority(0, 0)) == -1, e);
475475

476476
if (!faster) {

src/sudo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ get_user_info(struct user_details *ud)
537537

538538
ud->pid = getpid();
539539
ud->ppid = getppid();
540-
ud->pgid = getpgid(0);
540+
ud->pgid = getpgrp();
541541
ttyfd = open(_PATH_TTY, O_RDWR);
542542
sudo_get_ttysize(ttyfd, &ud->ts_rows, &ud->ts_cols);
543543
if (ttyfd != -1) {

0 commit comments

Comments
 (0)