sd-daemon: fix cppcheck warnings

Found with 'cppcheck --enable=all --inconclusive --std=posix' while
working with util-linux, which has a copy of this file.

[misc-utils/sd-daemon.c:363]: (style) Checking if unsigned variable \
'length' is less than zero.
[misc-utils/sd-daemon.c:366]: (style) Checking if unsigned variable \
'length' is less than zero.

References: http://www.spinics.net/lists/util-linux-ng/msg07031.html
This commit is contained in:
Sami Kerola 2012-12-17 11:13:17 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 23757887f7
commit d1d7caeeee

View file

@ -364,10 +364,10 @@ _sd_export_ int sd_is_socket_unix(int fd, int type, int listening, const char *p
return 0;
if (path) {
if (length <= 0)
if (length == 0)
length = strlen(path);
if (length <= 0)
if (length == 0)
/* Unnamed socket */
return l == offsetof(struct sockaddr_un, sun_path);