summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 04:48:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 04:48:35 +0000
commit207df6fc406e81bfeebdff7f404bd242ff3f099f (patch)
treea1a796b056909dd0a04ffec163db9363a8757808 /tools
parentReleasing progress-linux version 0.11.2-1~progress7.99u1. (diff)
downloadlnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.tar.xz
lnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.zip
Merging upstream version 0.12.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am7
-rw-r--r--tools/bin2c.c8
2 files changed, 11 insertions, 4 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 3dce4e8..4d18c78 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,8 +1,13 @@
all-local: bin2c$(BUILD_EXEEXT)
+if CROSS_COMPILING
bin2c$(BUILD_EXEEXT): bin2c.c
- $(AM_V_CC) $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -g3 -o $@ $? -lz
+ $(AM_V_CC) $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -g3 -o $@ $? -lz -fPIE
+else
+bin2c: bin2c.c
+ $(AM_V_CC) $(CC) $(CPPFLAGS) $(LDFLAGS) -g3 -o $@ $? -lz -fPIE
+endif
EXTRA_DIST = \
bin2c.c
diff --git a/tools/bin2c.c b/tools/bin2c.c
index 2141bf0..b4286b0 100644
--- a/tools/bin2c.c
+++ b/tools/bin2c.c
@@ -11,6 +11,7 @@
# include <alloca.h>
#endif
+#include <assert.h>
#include <ctype.h>
#include <fcntl.h>
#include <getopt.h>
@@ -67,7 +68,7 @@ process(struct file_meta* fm, FILE* ofile)
}
unsigned char* buf = malloc(st.st_size);
- unsigned char* dest = malloc(st.st_size);
+ unsigned char* dest = malloc(st.st_size + 1024);
int fd = open(fm->fm_name, O_RDONLY);
if (fd == -1) {
@@ -80,8 +81,9 @@ process(struct file_meta* fm, FILE* ofile)
fm->fm_size += rc;
}
- uLongf destLen = st.st_size;
- compress(dest, &destLen, buf, st.st_size);
+ uLongf destLen = st.st_size + 1024;
+ int cres = compress(dest, &destLen, buf, st.st_size);
+ assert(cres == Z_OK);
fm->fm_compressed_size = destLen;
int c, col = 1;