Skip to content

Commit

Permalink
log.h: add WARN
Browse files Browse the repository at this point in the history
Fix issue 107

Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda committed Dec 10, 2024
1 parent 393d10d commit 826f541
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ struct cli_options *cli_options_parse(int argc, char *argv[]) {
}
if (res->vmnet_gateway == NULL) {
if (res->vmnet_mode != VMNET_BRIDGED_MODE) {
ERROR("WARNING: --vmnet-gateway=IP should be explicitly specified to "
WARN("--vmnet-gateway=IP should be explicitly specified to "
"avoid conflicting with other applications");
}
if (res->vmnet_dhcp_end != NULL) {
Expand Down
3 changes: 3 additions & 0 deletions log.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ extern bool debug;
#define ERROR(msg) fprintf(stderr, "ERROR| " msg "\n")
#define ERRORF(fmt, ...) fprintf(stderr, "ERROR| " fmt "\n", __VA_ARGS__)
#define ERRORN(name) ERRORF(name ": %s", strerror(errno))
#define WARN(msg) fprintf(stderr, "WARN | " msg "\n")
#define WARNF(fmt, ...) fprintf(stderr, "WARN | " fmt "\n", __VA_ARGS__)


#endif /* SOCKET_VMNET_LOG_H */
6 changes: 2 additions & 4 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,10 @@ int main(int argc, char *argv[]) {
struct cli_options *cliopt = cli_options_parse(argc, argv);
assert(cliopt != NULL);
if (geteuid() != 0) {
ERROR("WARNING: Running without root. This is very unlikely to "
"work: See README.md");
WARN("Running without root. This is very unlikely to work: See README.md");
}
if (geteuid() != getuid()) {
ERROR("WARNING: Seems running with SETUID. This is insecure and "
"highly discouraged: See README.md");
WARN("Seems running with SETUID. This is insecure and highly discouraged: See README.md");
}

if (sigsetjmp(jmpbuf, 1) != 0) {
Expand Down

0 comments on commit 826f541

Please sign in to comment.