summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-11-26 20:09:20 +0000
committerMike Frysinger <vapier@gentoo.org>2005-11-26 20:09:20 +0000
commitbce1285d5c215b38e5e0e23354c908f53e0cbe24 (patch)
treea30a8d1af3f3d53a69a8c71ccdd915762c8453a6 /sys-apps/grep/files/grep-2.5.1-fix-devices-skip.patch
parentrename oi patch (diff)
downloadhistorical-bce1285d5c215b38e5e0e23354c908f53e0cbe24.tar.gz
historical-bce1285d5c215b38e5e0e23354c908f53e0cbe24.tar.bz2
historical-bce1285d5c215b38e5e0e23354c908f53e0cbe24.zip
Add patch upstream to fix handling of --devices and fifos #113640 by Ingo van Lil.
Package-Manager: portage-2.0.53_rc7
Diffstat (limited to 'sys-apps/grep/files/grep-2.5.1-fix-devices-skip.patch')
-rw-r--r--sys-apps/grep/files/grep-2.5.1-fix-devices-skip.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/sys-apps/grep/files/grep-2.5.1-fix-devices-skip.patch b/sys-apps/grep/files/grep-2.5.1-fix-devices-skip.patch
new file mode 100644
index 000000000000..aff800c32d85
--- /dev/null
+++ b/sys-apps/grep/files/grep-2.5.1-fix-devices-skip.patch
@@ -0,0 +1,55 @@
+http://bugs.gentoo.org/113640
+
+2004-11-20 Benno Schulenberg <benno@nietvergeten.nl> (tiny change)
+
+ * src/grep.c (reset): Move the stat check ...
+ (grepfile): ... here, and also check for a fifo.
+
+Index: src/grep.c
+===================================================================
+RCS file: /cvsroot/grep/grep/src/grep.c,v
+retrieving revision 1.83
+retrieving revision 1.84
+diff -u -p -r1.83 -r1.84
+--- src/grep.c 20 Nov 2004 16:15:57 -0000 1.83
++++ src/grep.c 20 Nov 2004 16:20:38 -0000 1.84
+@@ -255,19 +255,6 @@ reset (int fd, char const *file, struct
+ bufbeg[-1] = eolbyte;
+ bufdesc = fd;
+
+- if (fstat (fd, &stats->stat) != 0)
+- {
+- error (0, errno, "fstat");
+- return 0;
+- }
+- if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
+- return 0;
+-#ifndef DJGPP
+- if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode)))
+-#else
+- if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode)))
+-#endif
+- return 0;
+ if (S_ISREG (stats->stat.st_mode))
+ {
+ if (file)
+@@ -928,6 +915,19 @@ grepfile (char const *file, struct stats
+ }
+ else
+ {
++ if (stat (file, &stats->stat) != 0)
++ {
++ suppressible_error (file, errno);
++ return 1;
++ }
++ if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
++ return 1;
++#ifndef DJGPP
++ if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode) || S_ISFIFO(stats->stat.st_mode)))
++#else
++ if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode)))
++#endif
++ return 1;
+ while ((desc = open (file, O_RDONLY)) < 0 && errno == EINTR)
+ continue;
+