about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-05-18 10:20:42 -0400
committerRich Felker <dalias@aerifal.cx>2013-05-18 10:20:42 -0400
commit69ee9b2cb169ee843ac9e209f919d088499152f7 (patch)
tree99ed9ef7fb0b925084db87dc9f740fa6c866c28a
parent22730d65608db06500cc6e0be4aaec03238f996b (diff)
downloadmusl-69ee9b2cb169ee843ac9e209f919d088499152f7.tar.gz
musl-69ee9b2cb169ee843ac9e209f919d088499152f7.tar.xz
musl-69ee9b2cb169ee843ac9e209f919d088499152f7.zip
make err.h functions print __progname
patch by Strake. previously is was not feasible to duplicate this
functionality of the functions these were modeled on, since argv[0]
was not saved at program startup, but now that it's available it's
easy to use.
-rw-r--r--src/legacy/err.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/legacy/err.c b/src/legacy/err.c
index 0f748538..7b167b36 100644
--- a/src/legacy/err.c
+++ b/src/legacy/err.c
@@ -3,14 +3,18 @@
 #include <stdarg.h>
 #include <stdlib.h>
 
+extern char *__progname;
+
 void vwarn(const char *fmt, va_list ap)
 {
+	fprintf (stderr, "%s: ", __progname);
 	if (fmt) vfprintf(stderr, fmt, ap);
 	perror("");
 }
 
 void vwarnx(const char *fmt, va_list ap)
 {
+	fprintf (stderr, "%s: ", __progname);
 	if (fmt) vfprintf(stderr, fmt, ap);
 	putc('\n', stderr);
 }