commit ee995033237908de40307d05fc05455aa80d5b15
parent c64d3e7854767475dc75b15b3b9105b462c33e32
Author: Joris Vink <joris@coders.se>
Date: Tue, 15 Oct 2013 13:09:00 +0200
Fix building example module in OpenBSD.
Diffstat:
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/modules/example/build.sh b/modules/example/build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) 2013 Joris Vink <joris@coders.se>
#
diff --git a/modules/example/tools/inject.c b/modules/example/tools/inject.c
@@ -20,6 +20,7 @@
#include <ctype.h>
#include <err.h>
#include <errno.h>
+#include <inttypes.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -87,8 +88,15 @@ main(int argc, char *argv[])
close(fd);
printf("};\n\n");
- printf("u_int32_t static_len_%s_%s = %ld;\n", ext, argv[2], st.st_size);
- printf("time_t static_mtime_%s_%s = %ld;\n", ext, argv[2], st.st_mtime);
+ printf("u_int32_t static_len_%s_%s = %" PRId64 ";\n",
+ ext, argv[2], st.st_size);
+
+#if defined(OpenBSD)
+ printf("time_t static_mtime_%s_%s = %d;\n", ext, argv[2], st.st_mtime);
+#else
+ printf("time_t static_mtime_%s_%s = %" PRId64 ";\n",
+ ext, argv[2], st.st_mtime);
+#endif
fprintf(hdr, "extern u_int8_t static_%s_%s[];\n", ext, argv[2]);
fprintf(hdr, "extern u_int32_t static_len_%s_%s;\n", ext, argv[2]);
diff --git a/modules/skeleton/tools/inject.c b/modules/skeleton/tools/inject.c
@@ -20,6 +20,7 @@
#include <ctype.h>
#include <err.h>
#include <errno.h>
+#include <inttypes.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -87,8 +88,15 @@ main(int argc, char *argv[])
close(fd);
printf("};\n\n");
- printf("u_int32_t static_len_%s_%s = %ld;\n", ext, argv[2], st.st_size);
- printf("time_t static_mtime_%s_%s = %ld;\n", ext, argv[2], st.st_mtime);
+ printf("u_int32_t static_len_%s_%s = %" PRId64 ";\n",
+ ext, argv[2], st.st_size);
+
+#if defined(OpenBSD)
+ printf("time_t static_mtime_%s_%s = %d;\n", ext, argv[2], st.st_mtime);
+#else
+ printf("time_t static_mtime_%s_%s = %" PRId64 ";\n",
+ ext, argv[2], st.st_mtime);
+#endif
fprintf(hdr, "extern u_int8_t static_%s_%s[];\n", ext, argv[2]);
fprintf(hdr, "extern u_int32_t static_len_%s_%s;\n", ext, argv[2]);