#undef DIRINFO_DEBUG
+#include "config.h"
#include "e2fsck.h"
#include <sys/stat.h>
#include <fcntl.h>
uuid_unparse(ctx->fs->super->s_uuid, uuid);
sprintf(db->tdb_fn, "%s/%s-dirinfo-XXXXXX", tdb_dir, uuid);
fd = mkstemp(db->tdb_fn);
- db->tdb = tdb_open(db->tdb_fn, 0, TDB_CLEAR_IF_FIRST,
+ if (fd < 0) {
+ db->tdb = NULL;
+ return;
+ }
+
+ if (num_dirs < 99991)
+ num_dirs = 99991; /* largest 5 digit prime */
+
+ db->tdb = tdb_open(db->tdb_fn, num_dirs, TDB_NOLOCK | TDB_NOSYNC,
O_RDWR | O_CREAT | O_TRUNC, 0600);
close(fd);
}