summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-06-18 23:13:15 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-18 23:13:15 +0200
commitd0b170c8133d0c155b18aabef919693dcba406dd (patch)
treea0e6e6431effb5b87adc84b08c6d1ef558b62780 /src/main.c
parentc952c6ece28b6c0f774f823c917f458fe3424993 (diff)
main: don't segfault when --log-color is passed without parameter
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/main.c b/src/main.c
index 8a7f18ea9c..21b4174a87 100644
--- a/src/main.c
+++ b/src/main.c
@@ -412,19 +412,25 @@ static int parse_argv(int argc, char *argv[]) {
case ARG_LOG_COLOR:
- if ((r = log_show_color_from_string(optarg)) < 0) {
- log_error("Failed to parse log color setting %s.", optarg);
- return r;
- }
+ if (optarg) {
+ if ((r = log_show_color_from_string(optarg)) < 0) {
+ log_error("Failed to parse log color setting %s.", optarg);
+ return r;
+ }
+ } else
+ log_show_color(true);
break;
case ARG_LOG_LOCATION:
- if ((r = log_show_location_from_string(optarg)) < 0) {
- log_error("Failed to parse log location setting %s.", optarg);
- return r;
- }
+ if (optarg) {
+ if ((r = log_show_location_from_string(optarg)) < 0) {
+ log_error("Failed to parse log location setting %s.", optarg);
+ return r;
+ }
+ } else
+ log_show_location(true);
break;