I just ran this on the latest coreutils:

scan-build -o clang ./configure
scan-build -o clang make

and it flagged a possible problem in wc
where it could spin if it got a read error
on a large file containing file names to process.
I think the following may address this:

diff --git a/src/wc.c b/src/wc.c
index a1922ba..ae29f10 100644
--- a/src/wc.c
+++ b/src/wc.c
@@ -726,8 +726,8 @@ main (int argc, char **argv)
           switch (ai_err)
             {
             case AI_ERR_READ:
-              error (0, errno, _("%s: read error"), quote (files_from));
-              skip_file = true;
+              error (EXIT_FAILURE, errno, _("%s: read error"),
+                     quote (files_from));
               continue;
             case AI_ERR_MEM:
               xalloc_die ();

I also notice more warnings and a possible
uninitialized stat buf in cp.c.
I'll have a look at these later...

cheers,
Pádraig.

Reply via email to