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>
This commit is contained in:
parent
6720e95b30
commit
4deba8b779
@ -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);
|
argc = parse_options(argc, argv, options, merge_file_usage, 0);
|
||||||
if (argc != 3)
|
if (argc != 3)
|
||||||
usage_with_options(merge_file_usage, options);
|
usage_with_options(merge_file_usage, options);
|
||||||
if (quiet)
|
if (quiet) {
|
||||||
freopen("/dev/null", "w", stderr);
|
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++) {
|
for (i = 0; i < 3; i++) {
|
||||||
if (!names[i])
|
if (!names[i])
|
||||||
|
Loading…
Reference in New Issue
Block a user