From 9b755d1be592d17be3e84f73fc444441d6cd4082 Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Fri, 21 Feb 2020 00:02:04 +0100 Subject: rfs.c: fix integer comparison sign with variable With: ./configure CC=clang CFLAGS=-W -Wall -Wno-unused \ --no-create --no-recursion we have: rfs.c:86:20: warning: comparison of integers of different signs: '__off_t' (aka 'long') and 'size_t' (aka 'unsigned int') [-Wsign-compare] if (st.st_size != size) { ~~~~~~~~~~ ^ ~~~~ rfs.c:146:20: warning: comparison of integers of different signs: '__off_t' (aka 'long') and 'size_t' (aka 'unsigned int') [-Wsign-compare] if (st.st_size != size) { ~~~~~~~~~~ ^ ~~~~ This is caused by the following code: size_t size; [...] rc = stat([...], &st); if (st.st_size != size) { [...] } However the type of size is wrong as the stat system call returns a stat structure which has the following field: off_t st_size; /* Total size, in bytes */ Signed-off-by: Denis 'GNUtoo' Carikli --- samsung-ipc/rfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samsung-ipc/rfs.c b/samsung-ipc/rfs.c index 1bf986f..fc134bf 100644 --- a/samsung-ipc/rfs.c +++ b/samsung-ipc/rfs.c @@ -66,7 +66,7 @@ int ipc_nv_data_path_check(struct ipc_client *client) { struct stat st; char *path; - size_t size; + off_t size; int rc; if (client == NULL) @@ -126,7 +126,7 @@ int ipc_nv_data_backup_path_check(struct ipc_client *client) { struct stat st; char *backup_path; - size_t size; + off_t size; int rc; if (client == NULL) -- cgit v1.2.3