If the status output already goes to stdout, then it is not necessary to
redirect stdout for the diff machinery. (This case hangs on Windows for
unknown reasons.)
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
wt-status.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index 32d780a..e4999ea 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -312,15 +312,17 @@ static void wt_status_print_untracked(struct wt_status *s)
static void wt_status_print_verbose(struct wt_status *s)
{
struct rev_info rev;
- int saved_stdout;
+ int saved_stdout = -1;
fflush(s->fp);
/* Sigh, the entire diff machinery is hardcoded to output to
* stdout. Do the dup-dance...*/
- saved_stdout = dup(STDOUT_FILENO);
- if (saved_stdout < 0 ||dup2(fileno(s->fp), STDOUT_FILENO) < 0)
- die("couldn't redirect stdout\n");
+ if (fileno(s->fp) != STDOUT_FILENO) {
+ saved_stdout = dup(STDOUT_FILENO);
+ if (saved_stdout < 0 ||dup2(fileno(s->fp), STDOUT_FILENO) < 0)
+ die("couldn't redirect stdout\n");
+ }
init_revisions(&rev, NULL);
setup_revisions(0, NULL, &rev, s->reference);
@@ -330,7 +332,7 @@ static void wt_status_print_verbose(struct wt_status *s)
fflush(stdout);
- if (dup2(saved_stdout, STDOUT_FILENO) < 0)
+ if (saved_stdout >= 0 && dup2(saved_stdout, STDOUT_FILENO) < 0)
die("couldn't restore stdout\n");
close(saved_stdout);
}
--
1.5.4.1.126.ge5a7d
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Nick Piggin | Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS] |
| Greg KH | Linux 2.6.26.3 |
| Vladislav Bolkhovitin | Re: Integration of SCST in the mainstream Linux kernel |
| Greg KH | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
git: | |
| David Symonds | Re: git and binary files |
| Sam Song | Fwd: [OT] Re: Git via a proxy server? |
| Linus Torvalds | Re: [PATCH 0/6] Initial subproject support (RFC?) |
| Petr Baudis | Re: repo.or.cz wishes? |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Jeff Garzik | Re: Wasting our Freedom |
| Alexey Suslikov | OT: OpenBSD on Asus eeePC |
| ropers | Re: Real men don't attack straw men |
| David Howells | [PATCH 6/7] FS-Cache: CacheFiles: ia64: missing copy_page export [try #13] |
| Valdis.Kletnieks | Re: [RFD] Incremental fsck |
| Chris Mason | Re: [PATCH][RFC] fast file mapping for loop |
| Nikolai Joukov | Re: [ANNOUNCE] RAIF: Redundant Array of Independent Filesystems |
