Merge branch 'ds/win-syslog-compiler-fix' into maint

Workaround for a false positive compiler warning.
source: <pull.1294.git.1658256354725.gitgitgadget@gmail.com>

* ds/win-syslog-compiler-fix:
  compat/win32: correct for incorrect compiler warning
This commit is contained in:
Junio C Hamano 2022-08-05 15:51:37 -07:00
commit cba4c4a244

View file

@ -44,6 +44,7 @@ void syslog(int priority, const char *fmt, ...)
while ((pos = strstr(str, "%1")) != NULL) {
size_t offset = pos - str;
char *new_pos;
char *oldstr = str;
str = realloc(str, st_add(++str_len, 1));
if (!str) {
@ -51,9 +52,9 @@ void syslog(int priority, const char *fmt, ...)
warning_errno("realloc failed");
return;
}
pos = str + offset;
memmove(pos + 2, pos + 1, strlen(pos));
pos[1] = ' ';
new_pos = str + offset;
memmove(new_pos + 2, new_pos + 1, strlen(new_pos));
new_pos[1] = ' ';
}
switch (priority) {