]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Fix test-path-util unit test with some cwd path lengths
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 10 Jun 2017 07:35:54 +0000 (10:35 +0300)
committerGitLab <gitlab@git.dovecot.net>
Sat, 10 Jun 2017 08:22:55 +0000 (11:22 +0300)
The component-component directory might not have been created at all,
in which case the following symlink creations would fail since they were
already created to the same directory in a previous test.

src/lib/test-path-util.c

index 0d1c761c82c3d04560ed79841793f342090cc42f..9c056173976b8966b766957397489d00b99edbb5 100644 (file)
@@ -133,7 +133,7 @@ static void test_link_alloc(void)
        string_t *basedir = t_str_new(256);
        str_append(basedir, cwd);
        str_append(basedir, "/"TEMP_DIRNAME);
-       size_t len = nearest_power(I_MAX(127, str_len(basedir))) -
+       size_t len = nearest_power(I_MAX(127, str_len(basedir) + strlen(COMPONENT_COMPONENT) + 1)) -
                        strlen(COMPONENT_COMPONENT);
 
        while(str_len(basedir) < len) {