lib: Use serverid_exists in server_id_db_check_exclusive
authorVolker Lendecke <vl@samba.org>
Tue, 29 Sep 2015 23:01:46 +0000 (01:01 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 30 Sep 2015 21:51:13 +0000 (23:51 +0200)
If there's another process around there will typically be at most
one process. So there is no real need to run the plural version of
serverid_exists.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/server_id_db_util.c

index ead9ed3d3ffd0911b94dbecb599eed3b4f56a861..bc1eb0c56a9d393e59f655f7413bbaeba59dc06d 100644 (file)
@@ -71,15 +71,8 @@ static int server_id_db_check_exclusive(
        unsigned num_servers, struct server_id *servers)
 {
        struct server_id me = server_id_db_pid(db);
-       bool exists[num_servers];
-       bool ok;
        int i;
 
-       ok = serverids_exist(servers, num_servers, exists);
-       if (!ok) {
-               return ENOMEM;
-       }
-
        for (i=0; i<num_servers; i++) {
                int ret;
 
@@ -90,7 +83,7 @@ static int server_id_db_check_exclusive(
                        continue;
                }
 
-               if (exists[i]) {
+               if (serverid_exists(&servers[i])) {
                        return EEXIST;
                }