From: René Scharfe Date: Fri, 26 Dec 2008 10:17:04 +0000 (+0100) Subject: merge-file: handle freopen() failure X-Git-Tag: v1.6.1.1~40^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4deba8b7798aac52e33aa8e1c49a8cdc0940ac36;p=git.git merge-file: handle freopen() failure Report the error if redirection of stderr to /dev/null failed. This silences a compiler warning about ignoring the return value of freopen() on Ubuntu 8.10. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- diff --git a/builtin-merge-file.c b/builtin-merge-file.c index 9d4e87480..96edb97a8 100644 --- a/builtin-merge-file.c +++ b/builtin-merge-file.c @@ -51,8 +51,11 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) argc = parse_options(argc, argv, options, merge_file_usage, 0); if (argc != 3) usage_with_options(merge_file_usage, options); - if (quiet) - freopen("/dev/null", "w", stderr); + if (quiet) { + if (!freopen("/dev/null", "w", stderr)) + return error("failed to redirect stderr to /dev/null: " + "%s\n", strerror(errno)); + } for (i = 0; i < 3; i++) { if (!names[i])