]> granicus.if.org Git - file/commitdiff
Provide makeerror() when we don't have builtin-compress.
authorChristos Zoulas <christos@zoulas.com>
Fri, 13 Nov 2015 15:35:10 +0000 (15:35 +0000)
committerChristos Zoulas <christos@zoulas.com>
Fri, 13 Nov 2015 15:35:10 +0000 (15:35 +0000)
src/compress.c

index 28a4ae9a238e8386ef696ed4f56bb6cf447c54ff..c5a08d33b719e5c38c9006ce5ce6ba773ed03490 100644 (file)
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.88 2015/11/11 22:30:29 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.89 2015/11/11 22:50:12 christos Exp $")
 #endif
 
 #include "magic.h"
@@ -435,25 +435,6 @@ file_pipe2file(struct magic_set *ms, int fd, const void *startbuf,
 #define FNAME          (1 << 3)
 #define FCOMMENT       (1 << 4)
 
-static int
-makeerror(unsigned char **buf, size_t *len, const char *fmt, ...)
-{
-       char *msg;
-       va_list ap;
-       int rv;
-
-       va_start(ap, fmt);
-       rv = vasprintf(&msg, fmt, ap);
-       va_end(ap);
-       if (rv < 0) {
-               *buf = NULL;
-               *len = 0;
-               return NODATA;
-       }
-       *buf = (unsigned char *)msg;
-       *len = strlen(msg);
-       return ERRDATA;
-}
 
 private int
 uncompressgzipped(const unsigned char *old, unsigned char **newch, size_t *n)
@@ -532,6 +513,26 @@ err:
 }
 #endif
 
+static int
+makeerror(unsigned char **buf, size_t *len, const char *fmt, ...)
+{
+       char *msg;
+       va_list ap;
+       int rv;
+
+       va_start(ap, fmt);
+       rv = vasprintf(&msg, fmt, ap);
+       va_end(ap);
+       if (rv < 0) {
+               *buf = NULL;
+               *len = 0;
+               return NODATA;
+       }
+       *buf = (unsigned char *)msg;
+       *len = strlen(msg);
+       return ERRDATA;
+}
+
 static void
 closefd(int *fd, size_t i)
 {