* [PATCH] avoid more undefined handler
@ 2011-05-25 12:38 Jim Meyering
2011-07-08 8:42 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Jim Meyering @ 2011-05-25 12:38 UTC (permalink / raw)
To: dash
Clang also warned about this:
ANALYZE: eval.c evalpipe
eval.c:575:10: warning: Assigned value is garbage or undefined
prevfd = pip[0];
^ ~~~~~~
Here's a fix:
2011-05-25 Jim Meyering <meyering@redhat.com>
avoid more undefined handler
* src/eval.c (evalpipe): Ensure that pip[0] is defined before used.
From dca635b44d289eeb6b7d0fb6a60db37fb61bc863 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 25 May 2011 14:35:24 +0200
Subject: [PATCH] avoid more undefined handler
* src/eval.c (evalpipe): Ensure that pip[0] is defined before used.
Signed-off-by: Jim Meyering <meyering@redhat.com>
---
src/eval.c | 1 +
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/eval.c b/src/eval.c
index 911fb2c..a93e602 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -547,6 +547,7 @@ evalpipe(union node *n, int flags)
prevfd = -1;
for (lp = n->npipe.cmdlist ; lp ; lp = lp->next) {
prehash(lp->n);
+ pip[0] = -1;
pip[1] = -1;
if (lp->next) {
if (pipe(pip) < 0) {
--
1.7.5.2.609.g6dbbf
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] avoid more undefined handler
2011-05-25 12:38 [PATCH] avoid more undefined handler Jim Meyering
@ 2011-07-08 8:42 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2011-07-08 8:42 UTC (permalink / raw)
To: Jim Meyering; +Cc: dash
On Wed, May 25, 2011 at 12:38:09PM +0000, Jim Meyering wrote:
> Clang also warned about this:
>
> ANALYZE: eval.c evalpipe
> eval.c:575:10: warning: Assigned value is garbage or undefined
> prevfd = pip[0];
> ^ ~~~~~~
This isn't really a bug. If pip[0] is garbage at this point, then
we're the last element in a pipeline and prevfd will never be used
again.
If you can think of a way of solving this without adding to the code
size then I'll gladly apply it :)
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-08 8:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-25 12:38 [PATCH] avoid more undefined handler Jim Meyering
2011-07-08 8:42 ` Herbert Xu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.