git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 05/14] run-command.c: Initialise variable to suppress msvc warnings

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Dec 4, 2010, 19:01 UTC
Message-ID
<4CFA9024.3030505@ramsay1.demon.co.uk>

The msvc compiler thinks the 'failed_errno' variable could be used while uninitialised and issues 26 warnings thus:

    ...\git\run-command.c(142) : warning C4700: uninitialized local \
        variable 'failed_errno' used

In order to suppress the warnings, we simply initialise the variable to zero.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 run-command.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/run-command.c b/run-command.c
index 2a1041e..0dad4da 100644
--- a/run-command.c
+++ b/run-command.c
@@ -139,7 +139,7 @@ int start_command(struct child_process *cmd)
 {
 	int need_in, need_out, need_err;
 	int fdin[2], fdout[2], fderr[2];
-	int failed_errno = failed_errno;
+	int failed_errno = 0;
 
 	/*
 	 * In case of errors we must keep the promise to close FDs
-- 
1.7.3
Message 1 of 1 in “run-command.c: Initialise variable to suppress msvc warnings”
  1. 05/14 run-command.c: Initialise variable to suppress msvc warningsRamsay Jones, Dec 4, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.