Skip to content

Commit 58e3862

Browse files
committed
log.h: add WARN
Fix issue 107 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
1 parent 6f3eba2 commit 58e3862

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

cli.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ struct cli_options *cli_options_parse(int argc, char *argv[]) {
195195
}
196196
if (res->vmnet_gateway == NULL) {
197197
if (res->vmnet_mode != VMNET_BRIDGED_MODE) {
198-
ERROR("WARNING: --vmnet-gateway=IP should be explicitly specified to "
198+
WARN("--vmnet-gateway=IP should be explicitly specified to "
199199
"avoid conflicting with other applications");
200200
}
201201
if (res->vmnet_dhcp_end != NULL) {

log.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ extern bool debug;
1414
#define ERROR(msg) fprintf(stderr, "ERROR| " msg "\n")
1515
#define ERRORF(fmt, ...) fprintf(stderr, "ERROR| " fmt "\n", __VA_ARGS__)
1616
#define ERRORN(name) ERRORF(name ": %s", strerror(errno))
17+
#define WARN(msg) fprintf(stderr, "WARN | " msg "\n")
18+
#define WARNF(fmt, ...) fprintf(stderr, "WARN | " fmt "\n", __VA_ARGS__)
1719

1820
#endif /* SOCKET_VMNET_LOG_H */

main.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,10 @@ int main(int argc, char *argv[]) {
400400
struct cli_options *cliopt = cli_options_parse(argc, argv);
401401
assert(cliopt != NULL);
402402
if (geteuid() != 0) {
403-
ERROR("WARNING: Running without root. This is very unlikely to "
404-
"work: See README.md");
403+
WARN("Running without root. This is very unlikely to work: See README.md");
405404
}
406405
if (geteuid() != getuid()) {
407-
ERROR("WARNING: Seems running with SETUID. This is insecure and "
408-
"highly discouraged: See README.md");
406+
WARN("Seems running with SETUID. This is insecure and highly discouraged: See README.md");
409407
}
410408

411409
if (sigsetjmp(jmpbuf, 1) != 0) {

0 commit comments

Comments
 (0)