aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-10-07 21:29:25 +0200
committerMattias Andrée <maandree@operamail.com>2015-10-07 21:29:25 +0200
commit292d82951d3b85c8580d3b01eb7a9ac1494c02f8 (patch)
tree564d4c412b184dd03ffe5173da4a0fd2f2b8f2be
parentm readme (diff)
downloadslibc-292d82951d3b85c8580d3b01eb7a9ac1494c02f8.tar.gz
slibc-292d82951d3b85c8580d3b01eb7a9ac1494c02f8.tar.bz2
slibc-292d82951d3b85c8580d3b01eb7a9ac1494c02f8.tar.xz
m slibc_perror
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--include/slibc-error.h2
-rw-r--r--src/slibc-error.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/include/slibc-error.h b/include/slibc-error.h
index c474745..b7e02b7 100644
--- a/include/slibc-error.h
+++ b/include/slibc-error.h
@@ -213,7 +213,7 @@ int* __slibc_error_line(void) __GCC_ONLY(__attribute__((const))); /* TODO not im
*
* This is a slibc extension.
*
- * @param progname The name of the program, `NULL` to use `program_invocation_name`.
+ * @param progname The name of the program, `NULL` or empty to use `program_invocation_name`.
* @param filename The source code file where the error occurred.
* @param linenum The line in the source code where the error occurred.
* @param function The function in the source code where the error occurred.
diff --git a/src/slibc-error.c b/src/slibc-error.c
index fd103d1..26724f9 100644
--- a/src/slibc-error.c
+++ b/src/slibc-error.c
@@ -34,7 +34,7 @@
*
* This is a slibc extension.
*
- * @param progname The name of the program, `NULL` to use `program_invocation_name`.
+ * @param progname The name of the program, `NULL` or empty to use `program_invocation_name`.
* @param filename The source code file where the error occurred.
* @param linenum The line in the source code where the error occurred.
* @param function The function in the source code where the error occurred.
@@ -51,7 +51,7 @@ void slibc_perror(const char* progname, const char* filename, int linenum, const
int tty = isatty(STDERR_FILENO);
va_list args;
- if (progname == NULL)
+ if ((progname == NULL) || !*progname)
progname = program_invocation_name;
if (*error_code)