[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
nproc: fix return value for privileged processes
From: |
Bruno Haible |
Subject: |
nproc: fix return value for privileged processes |
Date: |
Tue, 09 Apr 2019 20:45:41 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-141-generic; KDE/5.18.0; x86_64; ; ) |
A silly typo, from day one.
2019-04-09 Bruno Haible <address@hidden>
nproc: Fix return value for privileged processes.
* lib/nproc.c (num_processors_ignoring_omp): Test getuid(), not
getpid().
diff --git a/lib/nproc.c b/lib/nproc.c
index 49d2601..77b8760 100644
--- a/lib/nproc.c
+++ b/lib/nproc.c
@@ -294,7 +294,7 @@ num_processors_ignoring_omp (enum nproc_query query)
MP_NAPROCS yields the number of processors available to unprivileged
processes. */
int nprocs =
- sysmp (query == NPROC_CURRENT && getpid () != 0
+ sysmp (query == NPROC_CURRENT && getuid () != 0
? MP_NAPROCS
: MP_NPROCS);
if (nprocs > 0)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- nproc: fix return value for privileged processes,
Bruno Haible <=