Skip to content

Commit dfabadf

Browse files
committed
config_format: cf_yaml: Align the behavior of dirname against POSIX
When nothing found of directory separators on the given argument of dirname(), we need to align this behavior. After aligning the behavior, we can proceed to load configurations from specified workdir folders. Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent 9191f70 commit dfabadf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/config_format/flb_cf_yaml.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,10 @@ static char *dirname(char *path)
537537
ptr = strrchr(path, '\\');
538538

539539
if (ptr == NULL) {
540-
return path;
540+
/* No directory component */
541+
return ".";
541542
}
543+
542544
*ptr++='\0';
543545
return path;
544546
}

0 commit comments

Comments
 (0)