aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)