Skip to content

Commit 5fbc0c1

Browse files
committed
Do not print any warning from dfu-util
1 parent d92603a commit 5fbc0c1

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

err.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
/*
3+
// The original macros are defined as follows:
4+
# define warnx(...) do {\
5+
fprintf(stderr, __VA_ARGS__);\
6+
fprintf(stderr, "\n");\ } while (0)
7+
# define warn(...) do {\
8+
fprintf(stderr, "%s: ", strerror(errno));\
9+
warnx(__VA_ARGS__); } while (0)
10+
*/
11+
// No-OP: do not report any warning
12+
# define warnx(...) do { } while(0)
13+
# define warn(...) do { } while(0)
14+
15+
# define errx(eval, ...) do {\
16+
warnx(__VA_ARGS__);\
17+
exit(eval); } while (0)
18+
# define err(eval, ...) do {\
19+
warn(__VA_ARGS__);\
20+
exit(eval); } while (0)

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
/*
4-
#cgo CPPFLAGS: -DHAVE_UNISTD_H -DHAVE_NANOSLEEP -I. -Idfu-util-0.11/src -I/usr/include/libusb-1.0
5-
#cgo CFLAGS: -DHAVE_UNISTD_H -DHAVE_NANOSLEEP -I. -Idfu-util-0.11/src -I/usr/include/libusb-1.0
4+
#cgo CPPFLAGS: -DHAVE_UNISTD_H -DHAVE_NANOSLEEP -DHAVE_ERR -I. -Idfu-util-0.11/src -I/usr/include/libusb-1.0
5+
#cgo CFLAGS: -DHAVE_UNISTD_H -DHAVE_NANOSLEEP -DHAVE_ERR -I. -Idfu-util-0.11/src -I/usr/include/libusb-1.0
66
#cgo LDFLAGS: -lusb-1.0
77
88
#include <dfu.h>

0 commit comments

Comments
 (0)