Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Nov 2025 16:41:44 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 258411] blacklistctl dump fails shortly after first use
Message-ID:  <bug-258411-227-VTNk7vaZgY@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-258411-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258411

--- Comment #2 from Ed Maste <emaste@freebsd.org> ---
IMO we should either not create but not populate the file, or just treat an
empty file as identical to a missing file. E.g. in state_open():

DB *
state_open(const char *dbname, int flags, mode_t perm)
{
        DB *db;

        ...
        db = dbopen(dbname, flags, perm, DB_HASH, &openinfo);
        if (db == NULL) {
                if (errno == ENOENT && (flags & O_CREAT) == 0)
                        return NULL;
                (*lfun)(LOG_ERR, "%s: can't open `%s' (%m)", __func__, dbname);
        }
        return db;
}

We could add a check for an empty file and also return NULL.

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-258411-227-VTNk7vaZgY>