diff options
author | Dan Williams <dcbw@redhat.com> | 2018-05-25 12:49:59 -0500 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-05-25 14:51:36 -0700 |
commit | dd8ff6ccf0d80107b1e23aa2cf794584e1a8597d (patch) | |
tree | 6b4dd1e6f8e85a21621baa4fe4f08fa6fbf49dcc /include/openvswitch | |
parent | 34d598d215399edf8c6a1473d814ab47475822cf (diff) | |
download | openvswitch-dd8ff6ccf0d80107b1e23aa2cf794584e1a8597d.tar.gz |
vlog: exit with error if explicitly specified logfile cannot be opened
It seems like if the user wanted a specific logfile but that request
cannot be fulfilled, OVS/OVN shouldn't just continue as if nothing
really happened (besides logging a warning).
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'include/openvswitch')
-rw-r--r-- | include/openvswitch/vlog.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/openvswitch/vlog.h b/include/openvswitch/vlog.h index 98d477911..19da4ab62 100644 --- a/include/openvswitch/vlog.h +++ b/include/openvswitch/vlog.h @@ -251,9 +251,15 @@ void vlog_rate_limit(const struct vlog_module *, enum vlog_level, case 'v': \ vlog_set_verbosity(optarg); \ break; \ - case OPT_LOG_FILE: \ - vlog_set_log_file(optarg); \ + case OPT_LOG_FILE: { \ + int err = vlog_set_log_file(optarg);\ + /* Exit if logfile explicitly given \ + * but cannot be opened. */ \ + if (err && optarg) { \ + exit(EXIT_FAILURE); \ + } \ break; \ + } \ case OPT_SYSLOG_IMPL: \ vlog_set_syslog_method(optarg); \ break; \ |