summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-08-05 22:51:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-08-05 22:51:37 (GMT)
commitcba4c4a244b8293af695e3fb7965fd73c160447a (patch)
tree66dcdcfa9ebce7bc80d13f06a687144c81a01d1f
parent5d2bf34c22df7857c45e49d020bf1b0f4bb0db86 (diff)
parentb4f52f09ae712e1a813375712b6e58be49255cd0 (diff)
downloadgit-cba4c4a244b8293af695e3fb7965fd73c160447a.zip
git-cba4c4a244b8293af695e3fb7965fd73c160447a.tar.gz
git-cba4c4a244b8293af695e3fb7965fd73c160447a.tar.bz2
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
-rw-r--r--compat/win32/syslog.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/compat/win32/syslog.c b/compat/win32/syslog.c
index 1f8d893..0af18d8 100644
--- a/compat/win32/syslog.c
+++ b/compat/win32/syslog.c
@@ -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) {