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