From 292d82951d3b85c8580d3b01eb7a9ac1494c02f8 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 7 Oct 2015 21:29:25 +0200 Subject: m slibc_perror MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- include/slibc-error.h | 2 +- src/slibc-error.c | 4 ++-- 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) -- cgit v1.2.3-70-g09d2