101 lines
3.0 KiB
Diff
101 lines
3.0 KiB
Diff
diff --color -Naur elfutils-0.182.orig/lib/error.c elfutils-0.182/lib/error.c
|
|
--- elfutils-0.182.orig/lib/error.c 1969-12-31 19:00:00.000000000 -0500
|
|
+++ elfutils-0.182/lib/error.c 2021-03-09 13:11:55.794150396 -0500
|
|
@@ -0,0 +1,54 @@
|
|
+
|
|
+#define _GNU_SOURCE
|
|
+#include <stdarg.h>
|
|
+#include <stdio.h>
|
|
+#include <stdlib.h>
|
|
+#include <string.h>
|
|
+#include "error.h"
|
|
+
|
|
+extern char *__progname;
|
|
+
|
|
+void (*error_print_progname)(void) = 0;
|
|
+unsigned int error_message_count = 0;
|
|
+int error_one_per_line = 0;
|
|
+
|
|
+static void eprint(int status, int e, const char *file, unsigned int line, const char *fmt, va_list ap)
|
|
+{
|
|
+ if (file && error_one_per_line) {
|
|
+ static const char *oldfile;
|
|
+ static unsigned int oldline;
|
|
+ if (line == oldline && strcmp(file, oldfile) == 0)
|
|
+ return;
|
|
+ oldfile = file;
|
|
+ oldline = line;
|
|
+ }
|
|
+ if (error_print_progname)
|
|
+ error_print_progname();
|
|
+ else
|
|
+ fprintf(stderr, "%s: ", __progname);
|
|
+ if (file)
|
|
+ fprintf(stderr, "%s:%u: ", file, line);
|
|
+ vfprintf(stderr, fmt, ap);
|
|
+ if (e)
|
|
+ fprintf(stderr, ": %s\n", strerror(e));
|
|
+ error_message_count++;
|
|
+ if (status)
|
|
+ exit(status);
|
|
+}
|
|
+
|
|
+void error(int status, int e, const char *fmt, ...)
|
|
+{
|
|
+ va_list ap;
|
|
+ va_start(ap,fmt);
|
|
+ eprint(status, e, 0, 0, fmt, ap);
|
|
+ va_end(ap);
|
|
+}
|
|
+
|
|
+void error_at_line(int status, int e, const char *file, unsigned int line, const char *fmt, ...)
|
|
+{
|
|
+ va_list ap;
|
|
+ va_start(ap,fmt);
|
|
+ eprint(status, e, file, line, fmt, ap);
|
|
+ va_end(ap);
|
|
+}
|
|
+
|
|
diff --color -Naur elfutils-0.182.orig/lib/error.h elfutils-0.182/lib/error.h
|
|
--- elfutils-0.182.orig/lib/error.h 1969-12-31 19:00:00.000000000 -0500
|
|
+++ elfutils-0.182/lib/error.h 2021-03-09 13:11:55.794150396 -0500
|
|
@@ -0,0 +1,7 @@
|
|
+extern void (*error_print_progname)(void);
|
|
+extern unsigned int error_message_count;
|
|
+extern int error_one_per_line;
|
|
+
|
|
+void error(int, int, const char *, ...);
|
|
+void error_at_line(int, int, const char *, unsigned int, const char *, ...);
|
|
+
|
|
diff --color -Naur elfutils-0.182.orig/lib/Makefile.in elfutils-0.182/lib/Makefile.in
|
|
--- elfutils-0.182.orig/lib/Makefile.in 2020-10-31 18:38:59.000000000 -0400
|
|
+++ elfutils-0.182/lib/Makefile.in 2021-03-09 13:13:37.813935639 -0500
|
|
@@ -113,7 +113,8 @@
|
|
libeu_a_LIBADD =
|
|
am_libeu_a_OBJECTS = xstrdup.$(OBJEXT) xstrndup.$(OBJEXT) \
|
|
xmalloc.$(OBJEXT) next_prime.$(OBJEXT) crc32.$(OBJEXT) \
|
|
- crc32_file.$(OBJEXT) color.$(OBJEXT) printversion.$(OBJEXT)
|
|
+ crc32_file.$(OBJEXT) color.$(OBJEXT) printversion.$(OBJEXT) \
|
|
+ error.$(OBJEXT)
|
|
libeu_a_OBJECTS = $(am_libeu_a_OBJECTS)
|
|
AM_V_P = $(am__v_P_@AM_V@)
|
|
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
|
diff --color -Naur elfutils-0.182.orig/lib/system.h elfutils-0.182/lib/system.h
|
|
--- elfutils-0.182.orig/lib/system.h 2020-10-31 18:38:55.000000000 -0400
|
|
+++ elfutils-0.182/lib/system.h 2021-03-09 13:17:24.393600728 -0500
|
|
@@ -30,13 +30,13 @@
|
|
#define LIB_SYSTEM_H 1
|
|
|
|
#include <errno.h>
|
|
-#include <error.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <sys/param.h>
|
|
#include <endian.h>
|
|
#include <byteswap.h>
|
|
#include <unistd.h>
|
|
+#include "error.h"
|
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
# define LE32(n) (n)
|