+2008-05-16 10:25 Christos Zoulas <christos@astron.com>
+
+ * Fix compiler warnings.
+
+ * remove stray printf, and fix a vprintf bug. (Martin Dorey)
+
2008-05-06 00:13 Robert Byrnes <byrnes@wildpumpkin.net>
* src/Makefile.am:
#endif
#ifndef lint
-FILE_RCSID("@(#)$File: funcs.c,v 1.39 2008/03/01 22:21:49 rrt Exp $")
+FILE_RCSID("@(#)$File: funcs.c,v 1.40 2008/05/09 14:20:28 christos Exp $")
#endif /* lint */
/*
* Like printf, only we append to a buffer.
*/
protected int
-file_printf(struct magic_set *ms, const char *fmt, ...)
+file_vprintf(struct magic_set *ms, const char *fmt, va_list ap)
{
- va_list ap;
int len;
char *buf, *newstr;
- va_start(ap, fmt);
len = vasprintf(&buf, fmt, ap);
if (len < 0)
goto out;
- va_end(ap);
if (ms->o.buf != NULL) {
len = asprintf(&newstr, "%s%s", ms->o.buf, buf);
return -1;
}
+protected int
+file_printf(struct magic_set *ms, const char *fmt, ...)
+{
+ int rv;
+ va_list ap;
+
+ va_start(ap, fmt);
+ rv = file_vprintf(ms, fmt, ap);
+ va_end(ap);
+ return rv;
+}
+
/*
* error - print best error message possible
*/
ms->o.buf = NULL;
file_printf(ms, "line %u: ", lineno);
}
- file_printf(ms, f, va);
+ file_vprintf(ms, f, va);
if (error > 0)
file_printf(ms, " (%s)", strerror(error));
ms->haderr++;
#include "patchlevel.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.49 2008/02/17 19:28:54 rrt Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.50 2008/02/19 00:58:59 rrt Exp $")
#endif /* lint */
#ifndef PIPE_BUF
(void)strcat(strcpy(tmp, inname), ".exe");
if ((fd = open(tmp, flags)) < 0) {
#endif
- fprintf(stderr, "couldn't open file\n");
if (info_from_stat(ms, sb.st_mode) == -1)
goto done;
rv = 0;