]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
config: Allow empty string (meaning "disabled") in verify_absolute_path
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 16 Jul 2011 13:31:05 +0000 (15:31 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 17 Jul 2011 09:57:51 +0000 (11:57 +0200)
conf.c
test/test_conf.c

diff --git a/conf.c b/conf.c
index 6bc8a85ed8d81b9d3c1a376b19ea8215a3ec3f5a..0ad48b1cb32bd038eec5fed5bd268426c2dbc775 100644 (file)
--- 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);
index 6ca5629b27aed8eeae74486b48d55413a392c170..330e237c2f1da14b8b41c69a5d4f57d6c234d0bb 100644 (file)
@@ -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);
 }