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

[PATCH 1/2] bugfix: segfault on git diff --output=/bad/path

From
Larry D'Anna <larry@elder-gods.org>
Date
Feb 16, 2010, 04:10 UTC
Message-ID
<1266293446-8092-1-git-send-email-larry@elder-gods.org>
The return value from fopen wasn't being checked.
Signed-off-by: Larry D'Anna <larry@elder-gods.org>
---
 diff.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/diff.c b/diff.c
index 381cc8d..68def6c 100644
--- a/diff.c
+++ b/diff.c
@@ -2893,6 +2893,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
 		;
 	else if (!prefixcmp(arg, "--output=")) {
 		options->file = fopen(arg + strlen("--output="), "w");
+		if (!options->file)
+			die_errno("Could not open '%s'", arg + strlen("--output="));
 		options->close_file = 1;
 	} else
 		return 0;
-- 
1.7.0.rc2.40.g7d8aa
Next: Larry D'Anna
Message 1 of 5 in “bugfix: segfault on git diff --output=/bad/path”
  1. 1/2 bugfix: segfault on git diff --output=/bad/pathLarry D'Anna, Feb 16, 2010
  2. 2/2 bugfix: git diff --quiet -w never returns with exit status 1Larry D'Anna, Feb 16, 2010
  3. Junio C HamanoFeb 16, 2010
  4. Larry D'AnnaFeb 16, 2010
  5. 2/2 bugfix: git diff --quiet -w never returns with exit status 1Larry D'Anna, Feb 16, 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.