tdb: always set tdb->tracefd to -1 to be safe on goto fail
authorStefan Metzmacher <metze@samba.org>
Thu, 19 Nov 2009 08:38:48 +0000 (09:38 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 20 Nov 2009 08:45:34 +0000 (09:45 +0100)
metze

lib/tdb/common/open.c

index 64efafeb22647c0e273d7f7621af420e6427af68..4ea4499dc14225a042de7adb287a8de6ba44fe23 100644 (file)
@@ -163,6 +163,9 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
        }
        tdb_io_init(tdb);
        tdb->fd = -1;
        }
        tdb_io_init(tdb);
        tdb->fd = -1;
+#ifdef TDB_TRACE
+       tdb->tracefd = -1;
+#endif
        tdb->name = NULL;
        tdb->map_ptr = NULL;
        tdb->flags = tdb_flags;
        tdb->name = NULL;
        tdb->map_ptr = NULL;
        tdb->flags = tdb_flags;
@@ -207,10 +210,6 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
                        TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: tdb_new_database failed!"));
                        goto fail;
                }
                        TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: tdb_new_database failed!"));
                        goto fail;
                }
-#ifdef TDB_TRACE
-               /* All tracing will fail.  That's ok. */
-               tdb->tracefd = -1;
-#endif
                goto internal;
        }
 
                goto internal;
        }