diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-02-21 00:02:04 +0100 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-02-21 00:53:04 +0100 |
commit | 9b755d1be592d17be3e84f73fc444441d6cd4082 (patch) | |
tree | ea6acf24a1381596c398373e9888b923be98e380 | |
parent | fa4003fb44db3225bfa90ad299be03315063a819 (diff) | |
download | hardware_replicant_libsamsung-ipc-9b755d1be592d17be3e84f73fc444441d6cd4082.tar.gz hardware_replicant_libsamsung-ipc-9b755d1be592d17be3e84f73fc444441d6cd4082.tar.bz2 hardware_replicant_libsamsung-ipc-9b755d1be592d17be3e84f73fc444441d6cd4082.zip |
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 <GNUtoo@cyberdimension.org>
-rw-r--r-- | samsung-ipc/rfs.c | 4 |
1 files 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) |