summaryrefslogtreecommitdiff
path: root/source3/utils/profiles.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-10-02 18:22:48 +0000
committerJeremy Allison <jra@samba.org>2003-10-02 18:22:48 +0000
commit4ed89be00f0239179182da04b6c3d017a639664d (patch)
treea46f20067f18b8ceda3c6c0aca5d4cfe3a04fb45 /source3/utils/profiles.c
parente8fb38d8dda4fe44324c454c88e3e58d2e877a56 (diff)
downloadsamba-4ed89be00f0239179182da04b6c3d017a639664d.tar.gz
samba-4ed89be00f0239179182da04b6c3d017a639664d.tar.bz2
samba-4ed89be00f0239179182da04b6c3d017a639664d.zip
Portability fixes from schmitz@hp.com (Joachim Schmitz). Bug #549.
Jeremy. (This used to be commit 6defe43e6d48619cee31b6c7fc602973e8eeef3f)
Diffstat (limited to 'source3/utils/profiles.c')
-rw-r--r--source3/utils/profiles.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/utils/profiles.c b/source3/utils/profiles.c
index 3230eb21fc..20b1222e72 100644
--- a/source3/utils/profiles.c
+++ b/source3/utils/profiles.c
@@ -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);