Skip to content

Commit 011058a

Browse files
dcfldd_error: support program_invocation_name
This makes our error() implementation more glibc-like.
1 parent fe8ca4e commit 011058a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/dcfldd_error.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@
2626
#include <stdlib.h>
2727
#include <string.h>
2828

29-
#include "dcfldd.h" // to use program_name
29+
#ifdef _LIBC // GNU C library uses program_invocation_name for error(3).
30+
# define program_name program_invocation_name
31+
#endif
32+
33+
// calling program must define program_name and set it to argv[0]
34+
extern char *program_name;
3035

3136
/*
3237
* dcfldd_error(): a replacement for glibc's error() for usage within dcfldd

0 commit comments

Comments
 (0)