[announce] skalibs-2.3.2.0, s6-2.1.3.0

2015-03-13 Thread Laurent Bercot
Hello, * skalibs-2.3.2.0 is out. It fixes bugs reported by altell.ru's static analyzer. Thanks Altell! It also adds the gid0_scan() macro. http://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * s6-2.1.3.0 is out. It features new options to s6-envuidgid.

[PATCH 2/7] trysplice: remove unused 'buf' variable

2015-03-13 Thread Roman I Khimov
Cppcheck warns us here: Unused variable: buf and rightfully so. --- src/sysdeps/trysplice.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sysdeps/trysplice.c b/src/sysdeps/trysplice.c index 6b566b8..a408f13 100644 --- a/src/sysdeps/trysplice.c +++ b/src/sysdeps/trysplice.c @@ -10,7 +10,6

[PATCH 4/7] src: clarify '' vs '?' precedence

2015-03-13 Thread Roman I Khimov
Purely stylistic, suggested by cppcheck: Clarify calculation precedence for '' and '?' --- src/libstddjb/iobufferk_fill.c | 4 ++-- src/libstddjb/iobufferk_flush.c | 2 +- src/libunixonacid/unixmessage_receive.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff

[PATCH 5/7] child_spawn: fix possible fd_close() on uninited value

2015-03-13 Thread Roman I Khimov
If SKALIBS_HASPOSIXSPAWN is not defined and (n == 0), then we can easily end up calling fd_close() on error handling, since 'p' is never inited when n is 0. Found by Clang's scan-build. --- src/libstddjb/child_spawn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

NULL pointer dereference in skalibs's mininetstring_write()

2015-03-13 Thread Roman Khimov
Hello. This one was catched by Clang's scan-build: 9 int mininetstring_write (int fd, char const *s, uint16 len, uint32 *w) 10 { 11if (!w) 12{ 13 char pack[2] ; 14 uint16_pack_big(pack, len) ; 15 switch (fd_write(fd, pack, 2)) 16 {

Re: NULL pointer dereference in skalibs's mininetstring_write()

2015-03-13 Thread Laurent Bercot
On 13/03/2015 15:50, Roman Khimov wrote: 11if (!w) That one should be: if (!*w) It's obvious that if 'w' is NULL there will be NULL pointer dereference on line 19 or 20. What's not so obvious is how to properly fix that. Actually, w is never supposed to be NULL. Calling

Re: [PATCH 0/7] static analysis fixes for skalibs

2015-03-13 Thread Laurent Bercot
On 13/03/2015 15:24, Roman I Khimov wrote: Hello. Here at Altell we daily pass all of our project's software (and that is kinda whole distribution) through special 'static analysis' build that doesn't actually produce any output other than reports from two (currently) tools: cppcheck and

Re: [PATCH 0/7] static analysis fixes for skalibs

2015-03-13 Thread Roman Khimov
В письме от 13 марта 2015 16:16:26 пользователь Laurent Bercot написал: 1/7: I incremented 's' for clarity, because that's I always do in scanning functions. Normally the compiler ignores the useless increments and this does not worsen the resulting code. Do you think the increment

[PATCH 3/7] unixmessage_receive: reduce auxlen variable scope

2015-03-13 Thread Roman I Khimov
Purely stylistic, suggested by cppcheck. --- src/libunixonacid/unixmessage_receive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libunixonacid/unixmessage_receive.c b/src/libunixonacid/unixmessage_receive.c index 5fa16c4..885a7bc 100644 ---

Re: [PATCH 0/7] static analysis fixes for skalibs

2015-03-13 Thread Laurent Bercot
On 13/03/2015 16:47, Roman Khimov wrote: Both scan-build and cppcheck complain here. Sure, it's not an error, just a harmless dead code, but well, tools don't like dead code and I personally don't like it either, so IMO it's better to drop it if there are no valid reasons for it to stay.