bug-diffutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-diffutils] [PATCH] portability: avoid "diff - ..." failure at least


From: Jim Meyering
Subject: [bug-diffutils] [PATCH] portability: avoid "diff - ..." failure at least on *BSD and Solaris
Date: Wed, 10 Feb 2010 09:17:08 +0100

FYI, the new "stdin" test was failing on many types of systems.
This fixes it:

>From b50a16567acff496bdf3ac0004809b6dcc88c2d6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 10 Feb 2010 09:09:55 +0100
Subject: [PATCH] portability: avoid "diff - ..." failure at least on *BSD and 
Solaris

The new "stdin" test was failing on many types of systems.
* src/diff.c (compare_files): Guard use of xfreopen (NULL, "rb", ...
also with O_BINARY, so as to avoid this unnecessary call on
systems where it's not needed (on some it fails with "Bad address".
---
 src/diff.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/diff.c b/src/diff.c
index 25ef986..cc1b611 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1086,7 +1086,7 @@ compare_files (struct comparison const *parent,
          else if (STREQ (cmp.file[f].name, "-"))
            {
              cmp.file[f].desc = STDIN_FILENO;
-             if (binary && ! isatty (STDIN_FILENO))
+             if (O_BINARY && binary && ! isatty (STDIN_FILENO))
                xfreopen (NULL, "rb", stdin);
              if (fstat (STDIN_FILENO, &cmp.file[f].stat) != 0)
                cmp.file[f].desc = ERRNO_ENCODE (errno);
--
1.7.0.rc2.170.gbc565




reply via email to

[Prev in Thread] Current Thread [Next in Thread]