Skip to content

Commit cba4c4a

Browse files
committed
Merge branch 'ds/win-syslog-compiler-fix' into maint
Workaround for a false positive compiler warning. source: <[email protected]> * ds/win-syslog-compiler-fix: compat/win32: correct for incorrect compiler warning
2 parents 5d2bf34 + b4f52f0 commit cba4c4a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compat/win32/syslog.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,17 @@ void syslog(int priority, const char *fmt, ...)
4444

4545
while ((pos = strstr(str, "%1")) != NULL) {
4646
size_t offset = pos - str;
47+
char *new_pos;
4748
char *oldstr = str;
4849
str = realloc(str, st_add(++str_len, 1));
4950
if (!str) {
5051
free(oldstr);
5152
warning_errno("realloc failed");
5253
return;
5354
}
54-
pos = str + offset;
55-
memmove(pos + 2, pos + 1, strlen(pos));
56-
pos[1] = ' ';
55+
new_pos = str + offset;
56+
memmove(new_pos + 2, new_pos + 1, strlen(new_pos));
57+
new_pos[1] = ' ';
5758
}
5859

5960
switch (priority) {

0 commit comments

Comments
 (0)