From 15af38a25c679d3ed0f72bbc1109c6b34a959c39 Mon Sep 17 00:00:00 2001 From: Leo Ruan Date: Sat, 4 Aug 2018 20:07:43 +0200 Subject: [PATCH] Add compile option to disable error logging If you have an application stderr shall not be used by libsocketcan you can disable all error logging by defining DISABLE_ERROR_LOG. Signed-off-by: Leo Ruan Signed-off-by: Mark Jonas Signed-off-by: Marc Kleine-Budde --- src/libsocketcan.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libsocketcan.c b/src/libsocketcan.c index a1a4717..5c7665c 100644 --- a/src/libsocketcan.c +++ b/src/libsocketcan.c @@ -36,6 +36,12 @@ #include +/* Define DISABLE_ERROR_LOG to disable printing of error messages to stderr. */ +#ifdef DISABLE_ERROR_LOG +#define perror(x) +#define fprintf(...) +#endif + #define parse_rtattr_nested(tb, max, rta) \ (parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta)))