On Dec 16, 2007, at 5:58 PM, Johannes Schindelin wrote:
On Sun, 16 Dec 2007, Steffen Prohaska wrote:
Maybe we should just take it...
wt-status.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index 51c1879..2bfe60f 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -328,7 +328,7 @@ static void wt_status_print_verbose(struct
wt_status *s)
/* 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)
+ if (saved_stdout < 0 || dup2(dup(fileno(s->fp)), STDOUT_FILENO)
< 0)
die("couldn't redirect stdout\n");
init_revisions(&rev, NULL);
... but we should save the return of dup(fileno(s->fp) and close it
before leaving the function, no?
I pushed a commit to the "mob" branch. Please test, and if you're
content
with it, merge to "devel".
done.
I'll include this in the preview that I'll upload after we got
our google code quota raised.
An alternative would be to rewrite the diff machinery to accept a
file
descriptor. But I'm not sure if this is worth it.
diff.c | 296
+++++++++++++++++++++++++++++++++++-----------------------------
diff.h | 1 +
2 files changed, 163 insertions(+), 134 deletions(-)
Hmm.
FWIW I pushed it to the 'diff-no-stdout' branch of
http://repo.or.cz/w/git/dscho.git/
Dscho's commit 2210ccb53a8a119cbb14b650df913f46635dff89:
@@ -2541,8 +2567,8 @@ void diff_debug_queue(const char *msg, struct
diff_queue_struct *q)
{
int i;
if (msg)
- fprintf(stderr, "%s\n", msg);
- fprintf(stderr, "q->nr = %d\n", q->nr);
+ ffprintf(out, stderr, "%s\n", msg);
+ ffprintf(out, stderr, "q->nr = %d\n", q->nr);
for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
diff_debug_filepair(p, i);
This didn't compile, did it?
Steffen