]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: prefer hashmap_contains() over hashmap_get()
authorLennart Poettering <lennart@poettering.net>
Tue, 30 Apr 2019 11:47:33 +0000 (13:47 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 24 May 2019 13:05:27 +0000 (15:05 +0200)
src/login/logind-dbus.c

index 6dd4bcb17eb35d3af940da6957aa605e52baa821..1623151f8c3778ac519007bd2d5b0bec1e9c47fb 100644 (file)
@@ -845,11 +845,9 @@ static int method_create_session(sd_bus_message *message, void *userdata, sd_bus
                 if (asprintf(&id, "%"PRIu32, audit_id) < 0)
                         return -ENOMEM;
 
-                /* Wut? There's already a session by this name and we
-                 * didn't find it above? Weird, then let's not trust
-                 * the audit data and let's better register a new
-                 * ID */
-                if (hashmap_get(m->sessions, id)) {
+                /* Wut? There's already a session by this name and we didn't find it above? Weird, then let's
+                 * not trust the audit data and let's better register a new ID */
+                if (hashmap_contains(m->sessions, id)) {
                         log_warning("Existing logind session ID %s used by new audit session, ignoring.", id);
                         audit_id = AUDIT_SESSION_INVALID;
                         id = mfree(id);
@@ -863,7 +861,7 @@ static int method_create_session(sd_bus_message *message, void *userdata, sd_bus
                         if (asprintf(&id, "c%lu", ++m->session_counter) < 0)
                                 return -ENOMEM;
 
-                } while (hashmap_get(m->sessions, id));
+                } while (hashmap_contains(m->sessions, id));
         }
 
         /* The generated names should not clash with 'auto' or 'self' */