Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
bsd_compat.h: fix getprogname() to use program_invocation_* on glibc
rilysh committed 1 year ago
commit aa9a7de31f0658d384d8225c84414227de911501
parent d4b49b2
1 file changed +8 -8
modified compat/bsd_compat.h
@@ -196,15 +196,15 @@ FILE * funopen(const void *cookie, int (*readfn)(void *, char *, int),
#endif

#if !HAVE_GETPROGNAME
-
#if defined(__linux__)
-
extern char *__progname;
-
# define getprogname() __progname
-
#elif defined(__GLIBC__)
+
# if defined (__linux__) && defined (__GLIBC__)
extern char *program_invocation_short_name;
-
# define getprogname() program_invocation_short_name
-
#else
-
# error "Don't know how to replace getprogname()"
-
#endif
+
#  define getprogname()    program_invocation_short_name
+
# elif defined (__linux__) && !defined (__GLIBC__)
+
extern char *__progname;
+
#  define getprogname()    __progname
+
# else
+
#  error "Don't know how to replace getprogname()"
+
# endif
#endif

#endif