summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKirill Smelkov <kirr@mns.spb.ru>2009-10-21 21:18:56 +0400
committerRusty Russell <rusty@rustcorp.com.au>2009-10-29 10:14:33 +1030
commitb4424f8234a78a79fb2d71d46ca208b4f12e0f9e (patch)
tree51b84db81ee6ea5d0fd0e185efb6aa1b7d2b9330 /lib
parentcfed5f946de0992a594c189ee3c19cf98e59d380 (diff)
downloadsamba-b4424f8234a78a79fb2d71d46ca208b4f12e0f9e.tar.gz
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: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib')
-rw-r--r--lib/tdb/common/open.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c
index 1ba2e7bd11..64efafeb22 100644
--- a/lib/tdb/common/open.c
+++ b/lib/tdb/common/open.c
@@ -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 */