Skip to content

Commit 53de154

Browse files
Merge pull request #2 from marckleinebudde/fix-disable-logging
Fix disable logging
2 parents 077def3 + 8a77651 commit 53de154

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/libsocketcan.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242

4343
/* Define DISABLE_ERROR_LOG to disable printing of error messages to stderr. */
4444
#ifdef DISABLE_ERROR_LOG
45-
#define perror(x)
46-
#define fprintf(...)
45+
#define perror(x) while (0) { perror(x); }
46+
#define fprintf(stream, format, args...) while (0) { fprintf(stream, format, ##args); }
4747
#endif
4848

4949
#define parse_rtattr_nested(tb, max, rta) \
@@ -437,9 +437,9 @@ static int do_get_nl_link(int fd, __u8 acquire, const char *name, void *res)
437437
continue;
438438

439439
if (acquire == GET_XSTATS) {
440-
if (!linkinfo[IFLA_INFO_XSTATS])
440+
if (!linkinfo[IFLA_INFO_XSTATS]) {
441441
fprintf(stderr, "no can statistics found\n");
442-
else {
442+
} else {
443443
memcpy(res, RTA_DATA(linkinfo[IFLA_INFO_XSTATS]),
444444
sizeof(struct can_device_stats));
445445
ret = 0;

0 commit comments

Comments
 (0)