Skip to content

Commit

Permalink
Fix apps not coloring (due to calls to __fprintf_chk not captured)
Browse files Browse the repository at this point in the history
Should fix issues #30 (git) and #56 (cmp)
Added configuration checks
  • Loading branch information
DanOlivier committed Jul 3, 2017
1 parent 8eb0f8a commit 36660ba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Expand Up @@ -48,6 +48,7 @@ check_function_exists(vwarnc HAVE_VWARNC)
check_function_exists(warnx HAVE_WARNX)
check_function_exists(vwarnx HAVE_VWARNX)
check_function_exists(err_set_file HAVE_ERR_SET_FILE)
check_function_exists(__fprintf_chk HAVE__FPRINTF_CHK)

if (NOT HAVE_GLIBC)
check_function_exists(getprogname HAVE_GETPROGNAME)
Expand Down
1 change: 1 addition & 0 deletions src/config.h.in
Expand Up @@ -26,6 +26,7 @@
#cmakedefine HAVE_WARNX
#cmakedefine HAVE_VWARNX
#cmakedefine HAVE_ERR_SET_FILE
#cmakedefine HAVE__FPRINTF_CHK

#cmakedefine HAVE_GETPROGNAME

Expand Down
10 changes: 10 additions & 0 deletions src/stderred.c
Expand Up @@ -164,6 +164,16 @@ int FUNC(fprintf)(FILE *stream, const char *format, ...) {
return result;
}

#ifdef HAVE__FPRINTF_CHK
int FUNC(__fprintf_chk)(FILE *fp, int flag, const char *format, ...) {
va_list args;
va_start(args, format);
int result = FUNC(vfprintf)(fp, format, args);
va_end(args);
return result;
}
#endif

int FUNC(fprintf_unlocked)(FILE *stream, const char *format, ...) {
va_list args;
va_start(args, format);
Expand Down

0 comments on commit 36660ba

Please sign in to comment.