Skip to content

Commit b57df69

Browse files
cosmo0920edsiper
authored andcommitted
out_file: Handle drive letter properly
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent 9d3f10e commit b57df69

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

plugins/out_file/file.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,19 @@ static int mkpath(struct flb_output_instance *ins, const char *dir)
406406
return -1;
407407
}
408408

409+
p = parent_path;
410+
411+
/* Skip the drive letter if present (e.g., "C:") */
412+
if (p[1] == ':') {
413+
p += 2;
414+
}
415+
409416
/* Normalize all forward slashes to backslashes */
410-
for (p = parent_path; *p; ++p) {
417+
while (*p != '\0') {
411418
if (*p == '/') {
412419
*p = '\\';
413420
}
421+
p++;
414422
}
415423

416424
flb_plg_debug(ins, "starting to create directory %s", parent_path);

0 commit comments

Comments
 (0)