]> git.ipfire.org Git - thirdparty/git.git/blobdiff - compat/winansi.c
winansi: avoid use of uninitialized value
[thirdparty/git.git] / compat / winansi.c
index 793420f9d0d7732cb7dc2aa94845a22086fe7021..a551de90eb042804690ab4dbef6beee948693285 100644 (file)
@@ -105,6 +105,13 @@ static int is_console(int fd)
        if (!fd) {
                if (!GetConsoleMode(hcon, &mode))
                        return 0;
+               /*
+                * This code path is only reached if there is no console
+                * attached to stdout/stderr, i.e. we will not need to output
+                * any text to any console, therefore we might just as well
+                * use black as foreground color.
+                */
+               sbi.wAttributes = 0;
        } else if (!GetConsoleScreenBufferInfo(hcon, &sbi))
                return 0;