From ff13256a94285d41db8b9370ff29a6c211b6bf99 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sat, 16 Jul 2011 15:31:05 +0200 Subject: [PATCH] config: Allow empty string (meaning "disabled") in verify_absolute_path --- conf.c | 5 ++++- test/test_conf.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/conf.c b/conf.c index 6bc8a85ed..0ad48b1cb 100644 --- a/conf.c +++ b/conf.c @@ -152,7 +152,10 @@ verify_absolute_path(void *value, char **errmsg) { char **path = (char **)value; assert(*path); - if (is_absolute_path(*path)) { + if (str_eq(*path, "")) { + /* The empty string means "disable" in this case. */ + return true; + } else if (is_absolute_path(*path)) { return true; } else { *errmsg = format("not an absolute path: \"%s\"", *path); diff --git a/test/test_conf.c b/test/test_conf.c index 6ca5629b2..330e237c2 100644 --- a/test/test_conf.c +++ b/test/test_conf.c @@ -262,6 +262,9 @@ TEST(verify_absolute_base_dir) CHECK_STR_EQ_FREE2("ccache.conf:1: not an absolute path: \"relative/path\"", errmsg); + create_file("ccache.conf", "base_dir ="); + CHECK(conf_read(conf, "ccache.conf", &errmsg)); + conf_free(conf); } -- 2.47.3