ifupdown: only show granular locking errors in verbose mode

This commit is contained in:
Ariadne Conill 2020-07-29 03:18:12 -06:00
parent ef3bdd79da
commit 58bc969bbb

View file

@ -81,7 +81,8 @@ acquire_state_lock(const char *state_path, const char *lifname)
int fd = open(lockpath, O_CREAT | O_WRONLY | O_TRUNC); int fd = open(lockpath, O_CREAT | O_WRONLY | O_TRUNC);
if (fd < 0) if (fd < 0)
{ {
fprintf(stderr, "%s: while opening lockfile %s: %s\n", argv0, lockpath, strerror(errno)); if (exec_opts.verbose)
fprintf(stderr, "%s: while opening lockfile %s: %s\n", argv0, lockpath, strerror(errno));
return -2; return -2;
} }
@ -90,7 +91,8 @@ acquire_state_lock(const char *state_path, const char *lifname)
{ {
close(fd); close(fd);
fprintf(stderr, "%s: while getting flags for lockfile: %s\n", argv0, strerror(errno)); if (exec_opts.verbose)
fprintf(stderr, "%s: while getting flags for lockfile: %s\n", argv0, strerror(errno));
return -2; return -2;
} }
@ -99,7 +101,8 @@ acquire_state_lock(const char *state_path, const char *lifname)
{ {
close(fd); close(fd);
fprintf(stderr, "%s: while setting lockfile close-on-exec: %s\n", argv0, strerror(errno)); if (exec_opts.verbose)
fprintf(stderr, "%s: while setting lockfile close-on-exec: %s\n", argv0, strerror(errno));
return -2; return -2;
} }