[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[coreutils] clang-analyzer
From: |
Pádraig Brady |
Subject: |
[coreutils] clang-analyzer |
Date: |
Fri, 17 Dec 2010 16:11:12 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 |
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.
- [coreutils] clang-analyzer,
Pádraig Brady <=