diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-02-07 03:10:09 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-02-07 11:10:09 +0900 |
commit | 996def17f99bb3f41f82032860dfcb98ff19c3ae (patch) | |
tree | 0ab762cce8dbb8a08b900569886ea1eafe0b2b2d | |
parent | 3f602115b71e8dcbdf34f7193ecf91fc2506daa2 (diff) | |
download | systemd-996def17f99bb3f41f82032860dfcb98ff19c3ae.tar.gz |
process-util: use raw_getpid() in getpid_cache() internally (#8115)
We have the raw_getpid() definition in place anyway, and it's certainly
beneficial to expose the same semantics on pre glibc 2.24 and after it
too, hence always bypass glibc for this, and always cache things on our
side.
Fixes: #8113
-rw-r--r-- | src/basic/process-util.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c index dc7c9ef9ef..e04bcc9782 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -1137,7 +1137,7 @@ pid_t getpid_cached(void) { case CACHED_PID_UNSET: { /* Not initialized yet, then do so now */ pid_t new_pid; - new_pid = getpid(); + new_pid = raw_getpid(); if (__register_atfork(NULL, NULL, reset_cached_pid, __dso_handle) != 0) { /* OOM? Let's try again later */ @@ -1150,7 +1150,7 @@ pid_t getpid_cached(void) { } case CACHED_PID_BUSY: /* Somebody else is currently initializing */ - return getpid(); + return raw_getpid(); default: /* Properly initialized */ return current_value; |