|
|
|
|
Index: src/apprentice.c
|
|
|
|
|
--- src/apprentice.c.orig 2007-12-27 21:52:36 +0100
|
|
|
|
|
+++ src/apprentice.c 2008-03-31 20:50:08 +0200
|
|
|
|
|
@@ -549,6 +549,7 @@
|
|
|
|
|
file_oomem(ms, maxmagic * sizeof(*marray));
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
+ memset(marray, 0, maxmagic * sizeof(*marray));
|
|
|
|
|
marraycount = 0;
|
|
|
|
|
|
|
|
|
|
/* print silly verbose header for USG compat. */
|
|
|
|
|
Index: src/compress.c
|
|
|
|
|
--- src/compress.c.orig 2007-12-02 18:32:23 +0100
|
|
|
|
|
+++ src/compress.c 2008-03-31 20:50:08 +0200
|
|
|
|
|
@@ -167,7 +167,7 @@
|
|
|
|
|
* `safe' read for sockets and pipes.
|
|
|
|
|
*/
|
|
|
|
|
protected ssize_t
|
|
|
|
|
-sread(int fd, void *buf, size_t n, int canbepipe)
|
|
|
|
|
+file_sread(int fd, void *buf, size_t n, int canbepipe)
|
|
|
|
|
{
|
|
|
|
|
int rv, cnt;
|
|
|
|
|
#ifdef FIONREAD
|
|
|
|
|
@@ -261,7 +261,7 @@
|
|
|
|
|
if (swrite(tfd, startbuf, nbytes) != (ssize_t)nbytes)
|
|
|
|
|
r = 1;
|
|
|
|
|
else {
|
|
|
|
|
- while ((r = sread(fd, buf, sizeof(buf), 1)) > 0)
|
|
|
|
|
+ while ((r = file_sread(fd, buf, sizeof(buf), 1)) > 0)
|
|
|
|
|
if (swrite(tfd, buf, (size_t)r) != r)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@@ -462,7 +462,7 @@
|
|
|
|
|
n = 0;
|
|
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
- if ((r = sread(fdout[0], *newch, HOWMANY, 0)) <= 0) {
|
|
|
|
|
+ if ((r = file_sread(fdout[0], *newch, HOWMANY, 0)) <= 0) {
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
(void)fprintf(stderr, "Read failed (%s)\n",
|
|
|
|
|
strerror(errno));
|
|
|
|
|
Index: src/file.h
|
|
|
|
|
--- src/file.h.orig 2007-11-08 01:31:37 +0100
|
|
|
|
|
+++ src/file.h 2008-03-31 20:50:08 +0200
|
|
|
|
|
@@ -333,7 +333,7 @@
|
|
|
|
|
protected void file_showstr(FILE *, const char *, size_t);
|
|
|
|
|
protected size_t file_mbswidth(const char *);
|
|
|
|
|
protected const char *file_getbuffer(struct magic_set *);
|
|
|
|
|
-protected ssize_t sread(int, void *, size_t, int);
|
|
|
|
|
+protected ssize_t file_sread(int, void *, size_t, int);
|
|
|
|
|
protected int file_check_mem(struct magic_set *, unsigned int);
|
|
|
|
|
|
|
|
|
|
#ifndef COMPILE_ONLY
|
|
|
|
|
Index: src/magic.c
|
|
|
|
|
--- src/magic.c.orig 2007-12-27 17:35:59 +0100
|
|
|
|
|
+++ src/magic.c 2008-03-31 20:50:08 +0200
|
|
|
|
|
@@ -322,7 +322,7 @@
|
|
|
|
|
if (ispipe) {
|
|
|
|
|
ssize_t r = 0;
|
|
|
|
|
|
|
|
|
|
- while ((r = sread(fd, (void *)&buf[nbytes],
|
|
|
|
|
+ while ((r = file_sread(fd, (void *)&buf[nbytes],
|
|
|
|
|
(size_t)(HOWMANY - nbytes), 1)) > 0) {
|
|
|
|
|
nbytes += r;
|
|
|
|
|
if (r < PIPE_BUF) break;
|
|
|
|
|
Index: src/softmagic.c
|
|
|
|
|
--- src/softmagic.c.orig 2007-12-27 17:35:59 +0100
|
|
|
|
|
+++ src/softmagic.c 2008-03-31 20:50:08 +0200
|
|
|
|
|
@@ -288,10 +288,9 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef HAVE_STRNDUP
|
|
|
|
|
-char * strndup(const char *, size_t);
|
|
|
|
|
-
|
|
|
|
|
-char *
|
|
|
|
|
-strndup(const char *str, size_t n)
|
|
|
|
|
+#define strndup(str,n) magic_strndup(str,n)
|
|
|
|
|
+static char *
|
|
|
|
|
+magic_strndup(const char *str, size_t n)
|
|
|
|
|
{
|
|
|
|
|
size_t len;
|
|
|
|
|
char *copy;
|