Merge pull request #23658 from keszybz/gcc-warnings-2

Fixes for NULL-pointer arguments based on gcc warnings
This commit is contained in:
Luca Boccassi
2022-06-09 17:48:09 +01:00
committed by GitHub
9 changed files with 65 additions and 73 deletions
+9 -8
View File
@@ -328,8 +328,8 @@ static int dynamic_user_pop(DynamicUser *d, uid_t *ret_uid, int *ret_lock_fd) {
assert(ret_uid);
assert(ret_lock_fd);
/* Read the UID and lock fd that is stored in the storage AF_UNIX socket. This should be called with the lock
* on the socket taken. */
/* Read the UID and lock fd that is stored in the storage AF_UNIX socket. This should be called with
* the lock on the socket taken. */
k = receive_one_fd_iov(d->storage_socket[0], &iov, 1, MSG_DONTWAIT, &lock_fd);
if (k < 0)
@@ -531,7 +531,8 @@ int dynamic_user_current(DynamicUser *d, uid_t *ret) {
assert(d);
/* 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. */
/* 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 = lockfp(d->storage_socket[0], &storage_socket0_lock);
if (r < 0)
@@ -555,9 +556,9 @@ static DynamicUser* dynamic_user_unref(DynamicUser *d) {
if (!d)
return NULL;
/* Note that this doesn't actually release any resources itself. If a dynamic user should be fully destroyed
* and its UID released, use dynamic_user_destroy() instead. NB: the dynamic user table may contain entries
* with no references, which is commonly the case right before a daemon reload. */
/* Note that this doesn't actually release any resources itself. If a dynamic user should be fully
* destroyed and its UID released, use dynamic_user_destroy() instead. NB: the dynamic user table may
* contain entries with no references, which is commonly the case right before a daemon reload. */
assert(d->n_ref > 0);
d->n_ref--;
@@ -571,8 +572,8 @@ static int dynamic_user_close(DynamicUser *d) {
uid_t uid;
int r;
/* 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. */
/* 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 = lockfp(d->storage_socket[0], &storage_socket0_lock);
if (r < 0)