Portability fixes from schmitz@hp.com (Joachim Schmitz). Bug #549.
authorJeremy Allison <jra@samba.org>
Thu, 2 Oct 2003 18:22:51 +0000 (18:22 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 2 Oct 2003 18:22:51 +0000 (18:22 +0000)
Jeremy.
(This used to be commit 93669f329eccec34d4a1da6239ae9759f067fb8b)

source3/tdb/tdbback.c
source3/tdb/tdbbackup.c
source3/utils/profiles.c

index 744cface557947012380a31aa32eb52d86dd7547..9466c2999108b80872bc74ddb337a8d72fe519c7 100644 (file)
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#ifdef STANDALONE
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <time.h>
 #include <sys/mman.h>
+
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <ctype.h>
 #include <signal.h>
+
+#else
+#include "includes.h"
+#endif
+
 #include "tdb.h"
 
 static int failed;
index 0eaf6b6c0b7e68cbba3ed4b772469942a1dfbf37..1a0e1c1588fdc4affd532ae7c699c6f1e6a35d91 100644 (file)
 
  */
 
+#ifdef STANDALONE
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <sys/time.h>
 #include <ctype.h>
 #include <signal.h>
+
+#else
+
+#include "includes.h"
+
+#endif
+
 #include "tdb.h"
 #include "tdbback.h"
 
index 3230eb21fc88fb44555f180743d38f19968dd4f6..20b1222e72372102a2fb0577d3ff6fef66dd021a 100644 (file)
@@ -295,7 +295,6 @@ Hope this helps....  (Although it was "fun" for me to uncover this things,
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include <sys/mman.h>
 
 typedef unsigned int DWORD;
 typedef unsigned short WORD;
@@ -610,7 +609,12 @@ int main(int argc, char *argv[])
    * dealing with the records. We are interested in the sk record
    */
   start = 0;
+
+#ifdef HAVE_MMAP
   base = mmap(&start, sbuf.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+#else
+  base = (char *)-1;
+#endif
 
   if ((int)base == -1) {
     fprintf(stderr, "Could not mmap file: %s, %s\n", poptPeekArg(pc),
@@ -726,7 +730,9 @@ int main(int argc, char *argv[])
     sk_hdr = (SK_HDR *)(base + OFF(IVAL(&sk_hdr->prev_off, 0)));
   } while (sk_off != first_sk_off);
 
+#ifdef HAVE_MMAP
   munmap(base, sbuf.st_size); 
+#endif
 
   poptFreeContext(pc);