diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-02-20 23:50:05 +0100 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-02-21 00:21:09 +0100 |
commit | fa4003fb44db3225bfa90ad299be03315063a819 (patch) | |
tree | 78652516f6eceaa677544685dc69389d25b6fa6e | |
parent | 86d3646e6c2dfad59c97aa39e944d97f4b3feed5 (diff) | |
download | hardware_replicant_libsamsung-ipc-fa4003fb44db3225bfa90ad299be03315063a819.tar.gz hardware_replicant_libsamsung-ipc-fa4003fb44db3225bfa90ad299be03315063a819.tar.bz2 hardware_replicant_libsamsung-ipc-fa4003fb44db3225bfa90ad299be03315063a819.zip |
ipc.c: fix integer comparison sign
With:
./configure CC=clang CFLAGS=-W -Wall -Wno-unused \
--no-create --no-recursion
we have:
CC ipc.lo
ipc.c:71:16: warning: comparison of integers of
different signs: 'size_t' (aka 'unsigned int') and
'int' [-Wsign-compare]
if (length == -1)
~~~~~~ ^ ~~
This is caused by the following code:
size_t length;
[...]
length = read(fd, &buffer, sizeof(buffer));
if (length == -1)
goto error;
However, as per the function definition, read uses ssize_t
which is the signed version of size_t:
ssize_t read(int fd, void *buf, size_t count);
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r-- | samsung-ipc/ipc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c index 50b6980..2aaaff6 100644 --- a/samsung-ipc/ipc.c +++ b/samsung-ipc/ipc.c @@ -51,7 +51,7 @@ int ipc_device_detect(void) char *line, *p, *c; int index = -1; int fd = -1; - size_t length; + ssize_t length; int i; #ifdef IPC_DEVICE_NAME |