]> git.ipfire.org Git - location/libloc.git/commitdiff
database: Correctly check return value of dup()
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 10 Mar 2025 10:53:30 +0000 (10:53 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 10 Mar 2025 10:53:30 +0000 (10:53 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/database.c

index a54d72abe0a8b407ee3721e528e154d8eeb51966..0c8608542aaad6e82c4d8602bbeb388ab43225bb 100644 (file)
@@ -403,7 +403,7 @@ static int loc_database_clone_handle(struct loc_database* db, FILE* f) {
 
        // Clone file descriptor
        fd = dup(fd);
-       if (!fd) {
+       if (fd < 0) {
                ERROR(db->ctx, "Could not duplicate file descriptor\n");
                return 1;
        }