summaryrefslogtreecommitdiff
path: root/builtin-merge-file.c
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2008-12-26 11:17:04 +0100
committerJunio C Hamano <gitster@pobox.com>2008-12-26 19:10:02 -0800
commit4deba8b7798aac52e33aa8e1c49a8cdc0940ac36 (patch)
tree25d5ab9c855e6d37e352119ab86f3d215469b7ef /builtin-merge-file.c
parent6720e95b305737fddc776f2904c339a0701e6ae2 (diff)
downloadgit-4deba8b7798aac52e33aa8e1c49a8cdc0940ac36.tar.gz
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 <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-merge-file.c')
-rw-r--r--builtin-merge-file.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin-merge-file.c b/builtin-merge-file.c
index 9d4e874809..96edb97a83 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])