diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2023-03-13 13:05:19 +0100 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2023-03-13 13:06:42 +0100 |
commit | 1fe15cb7a965f02c8050cb8cd28efa43e81792a7 (patch) | |
tree | ea896b4d987c0d9293ef1f632d7effa71ba6e357 /src/core | |
parent | 846c9c12e75e832e41a6c21ee818f6726c142214 (diff) | |
download | systemd-1fe15cb7a965f02c8050cb8cd28efa43e81792a7.tar.gz |
dynamic-user: Revert back to using POSIX locks
unposix locks are shared between child and parent after fork() which
is precisely what we don't want in this case so revert back to POSIX
locks which are not shared between parent and child.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/dynamic-user.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/core/dynamic-user.c b/src/core/dynamic-user.c index 42936bf567..3824ae747f 100644 --- a/src/core/dynamic-user.c +++ b/src/core/dynamic-user.c @@ -383,11 +383,11 @@ static int dynamic_user_realize( /* Acquire a UID for the user name. This will allocate a UID for the user name if the user doesn't exist * yet. If it already exists its existing UID/GID will be reused. */ - r = unposix_lock(d->storage_socket[0], LOCK_EX); + r = posix_lock(d->storage_socket[0], LOCK_EX); if (r < 0) return r; - CLEANUP_UNPOSIX_UNLOCK(d->storage_socket[0]); + CLEANUP_POSIX_UNLOCK(d->storage_socket[0]); r = dynamic_user_pop(d, &num, &uid_lock_fd); if (r < 0) { @@ -399,7 +399,7 @@ static int dynamic_user_realize( /* OK, nothing stored yet, let's try to find something useful. While we are working on this release the * lock however, so that nobody else blocks on our NSS lookups. */ - r = unposix_lock(d->storage_socket[0], LOCK_UN); + r = posix_lock(d->storage_socket[0], LOCK_UN); if (r < 0) return r; @@ -451,7 +451,7 @@ static int dynamic_user_realize( } /* So, we found a working UID/lock combination. Let's see if we actually still need it. */ - r = unposix_lock(d->storage_socket[0], LOCK_EX); + r = posix_lock(d->storage_socket[0], LOCK_EX); if (r < 0) { unlink_uid_lock(uid_lock_fd, num, d->name); return r; @@ -523,11 +523,11 @@ int dynamic_user_current(DynamicUser *d, uid_t *ret) { /* Get the currently assigned UID for the user, if there's any. This simply pops the data from the * storage socket, and pushes it back in right-away. */ - r = unposix_lock(d->storage_socket[0], LOCK_EX); + r = posix_lock(d->storage_socket[0], LOCK_EX); if (r < 0) return r; - CLEANUP_UNPOSIX_UNLOCK(d->storage_socket[0]); + CLEANUP_POSIX_UNLOCK(d->storage_socket[0]); r = dynamic_user_pop(d, &uid, &lock_fd); if (r < 0) @@ -565,11 +565,11 @@ static int dynamic_user_close(DynamicUser *d) { /* Release the user ID, by releasing the lock on it, and emptying the storage socket. After this the * user is unrealized again, much like it was after it the DynamicUser object was first allocated. */ - r = unposix_lock(d->storage_socket[0], LOCK_EX); + r = posix_lock(d->storage_socket[0], LOCK_EX); if (r < 0) return r; - CLEANUP_UNPOSIX_UNLOCK(d->storage_socket[0]); + CLEANUP_POSIX_UNLOCK(d->storage_socket[0]); r = dynamic_user_pop(d, &uid, &lock_fd); if (r == -EAGAIN) |