lib/tdb: if we know pwrite and pread are thread/fork safe tdb_reopen_all() should...
authorStefan Metzmacher <metze@samba.org>
Thu, 22 Jan 2009 09:54:12 +0000 (10:54 +0100)
committerTim Prouty <tprouty@samba.org>
Wed, 25 Feb 2009 21:57:11 +0000 (13:57 -0800)
The reason for tdb_reopen_all() is that the seek pointer on fds are shared between
parent and child.

metze

lib/tdb/common/open.c

index b19e4cea293df769a588db89c71df25529d677ec..e58c8ca7ff3c5b309a164199d5dc457b34686054 100644 (file)
@@ -461,6 +461,10 @@ fail:
 /* reopen all tdb's */
 int tdb_reopen_all(int parent_longlived)
 {
 /* reopen all tdb's */
 int tdb_reopen_all(int parent_longlived)
 {
+#if defined(LIBREPLACE_PREAD_NOT_REPLACED) && \
+       defined(LIBREPLACE_PWRITE_NOT_REPLACED)
+       return 0;
+#else
        struct tdb_context *tdb;
 
        for (tdb=tdbs; tdb; tdb = tdb->next) {
        struct tdb_context *tdb;
 
        for (tdb=tdbs; tdb; tdb = tdb->next) {
@@ -483,6 +487,7 @@ int tdb_reopen_all(int parent_longlived)
                if (tdb_reopen(tdb) != 0)
                        return -1;
        }
                if (tdb_reopen(tdb) != 0)
                        return -1;
        }
+#endif
 
        return 0;
 }
 
        return 0;
 }