Commit 56320b5f authored by Rusty Russell's avatar Rusty Russell

Import f5c992bdaeb73ef726ff4728a9922721474cd6f5 from ctdb:

    tdb: reset tdb->fd to -1 in tdb_close()
    
    So that erroneous double tdb_close() calls do not try to close() same
    fd again. This is like SAFE_FREE() but for fd.
Signed-off-by: default avatarKirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
    (cherry picked from samba commit b4424f8234a78a79fb2d71d46ca208b4f12e0f9e)
Signed-off-by: default avatarStefan Metzmacher <metze@samba.org>
parent e55e729c
......@@ -403,8 +403,10 @@ int tdb_close(struct tdb_context *tdb)
tdb_munmap(tdb);
}
SAFE_FREE(tdb->name);
if (tdb->fd != -1)
if (tdb->fd != -1) {
ret = close(tdb->fd);
tdb->fd = -1;
}
SAFE_FREE(tdb->lockrecs);
/* Remove from contexts list */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment