file: bump version

This commit is contained in:
Jerome Duval
2022-09-25 16:41:54 +02:00
parent 90ffa8065f
commit 987b666e34
3 changed files with 136 additions and 137 deletions

View File

@@ -10,7 +10,7 @@ COPYRIGHT="1986-1999 Ian F. Darwin
LICENSE="BSD (2-clause)"
REVISION="1"
SOURCE_URI="ftp://ftp.astron.com/pub/file/file-$portVersion.tar.gz"
CHECKSUM_SHA256="13e532c7b364f7d57e23dfeea3147103150cb90593a57af86c10e4f6e411603f"
CHECKSUM_SHA256="8c8015e91ae0e8d0321d94c78239892ef9dbc70c4ade0008c0e95894abfb1991"
PATCHES="file-$portVersion.patchset"
ARCHITECTURES="all"

View File

@@ -1,136 +0,0 @@
From 9ca3459aa9a4d2fa59434aed51e9bc84de0a3db7 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 12 May 2016 19:46:43 +0000
Subject: Haiku patch
diff --git a/configure.ac b/configure.ac
index 02eac8f..131a0da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,14 +152,14 @@ else
WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
-Wmissing-declarations -Wredundant-decls -Wnested-externs \
-Wsign-compare -Wreturn-type -Wswitch -Wshadow \
- -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
+ -Wcast-qual -Wwrite-strings -Wformat=2"
fi], [
if test "$GCC" = yes; then
AC_MSG_RESULT(yes)
WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
-Wmissing-declarations -Wredundant-decls -Wnested-externs \
-Wsign-compare -Wreturn-type -Wswitch -Wshadow \
- -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
+ -Wcast-qual -Wwrite-strings -Wformat=2"
else
WARNINGS=
AC_MSG_RESULT(no)
diff --git a/src/der.c b/src/der.c
index 4bee9f1..c202ca4 100644
--- a/src/der.c
+++ b/src/der.c
@@ -236,6 +236,7 @@ static int
der_data(char *buf, size_t blen, uint32_t tag, const void *q, uint32_t len)
{
const uint8_t *d = CAST(const uint8_t *, q);
+ uint32_t i;
switch (tag) {
case DER_TAG_PRINTABLE_STRING:
case DER_TAG_UTF8_STRING:
@@ -251,7 +252,7 @@ der_data(char *buf, size_t blen, uint32_t tag, const void *q, uint32_t len)
break;
}
- for (uint32_t i = 0; i < len; i++) {
+ for (i = 0; i < len; i++) {
uint32_t z = i << 1;
if (z < blen - 2)
snprintf(buf + z, blen - z, "%.2x", d[i]);
@@ -264,6 +265,7 @@ der_offs(struct magic_set *ms, struct magic *m, size_t nbytes)
{
const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes;
+ uint32_t tlen;
if (gettag(b, &offs, len) == DER_BAD) {
DPRINTF(("%s: bad tag 1\n", __func__));
@@ -272,7 +274,7 @@ der_offs(struct magic_set *ms, struct magic *m, size_t nbytes)
DPRINTF(("%s1: %d %" SIZE_T_FORMAT "u %u\n", __func__, ms->offset,
offs, m->offset));
- uint32_t tlen = getlength(b, &offs, len);
+ tlen = getlength(b, &offs, len);
if (tlen == DER_BAD) {
DPRINTF(("%s: bad tag 2\n", __func__));
return -1;
@@ -305,6 +307,7 @@ der_cmp(struct magic_set *ms, struct magic *m)
size_t offs = 0, len = ms->search.s_len;
uint32_t tag, tlen;
char buf[128];
+ size_t slen;
DPRINTF(("%s: compare %zu bytes\n", __func__, len));
@@ -327,7 +330,7 @@ der_cmp(struct magic_set *ms, struct magic *m)
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b,
buf, s);
- size_t slen = strlen(buf);
+ slen = strlen(buf);
if (strncmp(buf, s, slen) != 0)
return 0;
diff --git a/src/funcs.c b/src/funcs.c
index b926625..5a9462a 100644
--- a/src/funcs.c
+++ b/src/funcs.c
@@ -90,7 +90,8 @@ file_checkfield(char *msg, size_t mlen, const char *what, const char **pp)
protected int
file_checkfmt(char *msg, size_t mlen, const char *fmt)
{
- for (const char *p = fmt; *p; p++) {
+ const char *p;
+ for (p = fmt; *p; p++) {
if (*p != '%')
continue;
if (*++p == '%')
diff --git a/src/readelf.c b/src/readelf.c
index 0cd119a..87964d8 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -1017,6 +1017,7 @@ do_auxv_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
const char *tag;
int is_string;
size_t nval;
+ size_t off;
if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) !=
(FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE))
@@ -1044,7 +1045,7 @@ do_auxv_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
*flags |= FLAGS_DID_AUXV;
nval = 0;
- for (size_t off = 0; off + elsize <= descsz; off += elsize) {
+ for (off = 0; off + elsize <= descsz; off += elsize) {
memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
/* Limit processing to 50 vector entries to prevent DoS */
if (nval++ >= 50) {
@@ -1714,6 +1715,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
if (doread) {
len = xph_filesz < sizeof(nbuf) ? xph_filesz
: sizeof(nbuf);
+{
off_t offs = xph_offset;
bufsize = pread(fd, nbuf, len, offs);
if (bufsize == -1) {
@@ -1723,6 +1725,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
return -1;
return 0;
}
+}
} else
len = 0;
--
2.30.0

View File

@@ -0,0 +1,135 @@
From e2e9aae068f143aa7da969c6cedad9b1e85bece3 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 12 May 2016 19:46:43 +0000
Subject: Haiku patch
diff --git a/configure.ac b/configure.ac
index 6629300..cae8ed3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -151,14 +151,14 @@ else
WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
-Wmissing-declarations -Wredundant-decls -Wnested-externs \
-Wsign-compare -Wreturn-type -Wswitch -Wshadow \
- -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
+ -Wcast-qual -Wwrite-strings -Wformat=2"
fi], [
if test "$GCC" = yes; then
AC_MSG_RESULT(yes)
WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
-Wmissing-declarations -Wredundant-decls -Wnested-externs \
-Wsign-compare -Wreturn-type -Wswitch -Wshadow \
- -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
+ -Wcast-qual -Wwrite-strings -Wformat=2"
else
WARNINGS=
AC_MSG_RESULT(no)
diff --git a/src/compress.c b/src/compress.c
index b456626..6e74c86 100644
--- a/src/compress.c
+++ b/src/compress.c
@@ -741,9 +741,11 @@ movedesc(void *v, int i, int fd)
if (fd == i)
return; /* "no dup was necessary" */
#ifdef HAVE_POSIX_SPAWNP
+{
posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
posix_spawn_file_actions_adddup2(fa, fd, i);
posix_spawn_file_actions_addclose(fa, fd);
+}
#else
if (dup2(fd, i) == -1) {
DPRINTF("dup(%d, %d) failed (%s)\n", fd, i, strerror(errno));
diff --git a/src/der.c b/src/der.c
index cb44b9e..73e0e49 100644
--- a/src/der.c
+++ b/src/der.c
@@ -265,6 +265,7 @@ der_offs(struct magic_set *ms, struct magic *m, size_t nbytes)
{
const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes;
+ uint32_t tlen;
if (gettag(b, &offs, len) == DER_BAD) {
DPRINTF(("%s: bad tag 1\n", __func__));
@@ -273,7 +274,7 @@ der_offs(struct magic_set *ms, struct magic *m, size_t nbytes)
DPRINTF(("%s1: %d %" SIZE_T_FORMAT "u %u\n", __func__, ms->offset,
offs, m->offset));
- uint32_t tlen = getlength(b, &offs, len);
+ tlen = getlength(b, &offs, len);
if (tlen == DER_BAD) {
DPRINTF(("%s: bad tag 2\n", __func__));
return -1;
@@ -307,6 +308,7 @@ der_cmp(struct magic_set *ms, struct magic *m)
size_t offs = 0, len = ms->search.s_len;
uint32_t tag, tlen;
char buf[128];
+ size_t slen;
DPRINTF(("%s: compare %zu bytes\n", __func__, len));
@@ -329,7 +331,7 @@ der_cmp(struct magic_set *ms, struct magic *m)
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b,
buf, s);
- size_t slen = strlen(buf);
+ slen = strlen(buf);
if (strncmp(buf, s, slen) != 0) {
DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
diff --git a/src/file.c b/src/file.c
index 1566a17..2620ef0 100644
--- a/src/file.c
+++ b/src/file.c
@@ -531,8 +531,9 @@ out: file_err(EXIT_FAILURE, "Cannot allocate memory for file list");
if (line[len - 1] == '\n')
line[len - 1] = '\0';
if (fi >= fimax) {
+ char **nf;
fimax += 100;
- char **nf = CAST(char **,
+ nf = CAST(char **,
realloc(flist, fimax * sizeof(*flist)));
if (nf == NULL)
goto out;
diff --git a/src/funcs.c b/src/funcs.c
index 41c4106..0f9513f 100644
--- a/src/funcs.c
+++ b/src/funcs.c
@@ -668,6 +668,7 @@ file_regcomp(struct magic_set *ms file_locale_used, file_regex_t *rx,
strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
(void)setlocale(LC_CTYPE, "C");
#endif
+{
int rc;
rc = regcomp(rx, pat, flags);
@@ -685,6 +686,7 @@ file_regcomp(struct magic_set *ms file_locale_used, file_regex_t *rx,
}
return rc;
}
+}
/*ARGSUSED*/
protected int
@@ -699,6 +701,7 @@ file_regexec(struct magic_set *ms file_locale_used, file_regex_t *rx,
strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
(void)setlocale(LC_CTYPE, "C");
#endif
+{
int rc;
/* XXX: force initialization because glibc does not always do this */
if (nmatch != 0)
@@ -711,6 +714,7 @@ file_regexec(struct magic_set *ms file_locale_used, file_regex_t *rx,
#endif
return rc;
}
+}
protected void
file_regfree(file_regex_t *rx)
--
2.30.2