diff options
author | Martin Pool <mbp@samba.org> | 2001-12-10 06:09:42 +0000 |
---|---|---|
committer | Martin Pool <mbp@samba.org> | 2001-12-10 06:09:42 +0000 |
commit | 8c31fd48c8a2a509f3c9d2c21a450e3de6685389 (patch) | |
tree | 0d57e84ac1f25a1a257a007b9c94e4a2156547c9 /source3/tdb | |
parent | 2bbc91978b7d0b18191acb650a96f5e39d538c1c (diff) | |
download | samba-8c31fd48c8a2a509f3c9d2c21a450e3de6685389.tar.gz samba-8c31fd48c8a2a509f3c9d2c21a450e3de6685389.tar.bz2 samba-8c31fd48c8a2a509f3c9d2c21a450e3de6685389.zip |
Allocate tdb name up front in case log functions want to use it.
(This used to be commit a228c7efcc06b901ca51a6da77f8a52b77912f55)
Diffstat (limited to 'source3/tdb')
-rw-r--r-- | source3/tdb/tdb.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c index de376d29b2..1ca2974591 100644 --- a/source3/tdb/tdb.c +++ b/source3/tdb/tdb.c @@ -1422,6 +1422,11 @@ TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags, tdb->flags = tdb_flags; tdb->open_flags = open_flags; tdb->log_fn = log_fn; + + if (!(tdb->name = (char *)strdup(name))) { + errno = ENOMEM; + goto fail; + } if ((open_flags & O_ACCMODE) == O_WRONLY) { TDB_LOG((tdb, 0, "tdb_open_ex: can't open tdb %s write-only\n", @@ -1497,12 +1502,6 @@ TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags, goto fail; } - /* map the database and fill in the return structure */ - tdb->name = (char *)strdup(name); - if (!tdb->name) { - errno = ENOMEM; - goto fail; - } tdb->map_size = st.st_size; tdb->device = st.st_dev; tdb->inode = st.st_ino; |