Skip to content

Commit 393f457

Browse files
committed
perflib/err.c: use program_invocation_name on glibc
Signed-off-by: Eugene Syromiatnikov <[email protected]>
1 parent caed5ee commit 393f457

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

source/perflib/err.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,29 @@
1111
#include <stdio.h>
1212
#include <stdlib.h>
1313

14+
#include <openssl/e_os2.h>
15+
1416
const char *progname;
1517

18+
static ossl_inline void *
19+
get_progname(void)
20+
{
21+
if (progname != NULL)
22+
return progname;
23+
24+
#if defined(__GLIBC__)
25+
if (program_invocation_name && program_invocation_name[0])
26+
return program_invocation_name;
27+
#endif
28+
29+
return NULL;
30+
}
31+
1632
void
1733
vwarnx(const char *fmt, va_list ap)
1834
{
19-
if (progname != NULL)
20-
fprintf(stderr, "%s: ", progname);
35+
if (get_progname() != NULL)
36+
fprintf(stderr, "%s: ", get_progname());
2137
vfprintf(stderr, fmt, ap);
2238
putc('\n', stderr);
2339
}

0 commit comments

Comments
 (0)