[Replicant] [PATCH] devices: fix strncmp use

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Thu Sep 12 15:40:28 UTC 2019


Here the code tries to match for "Hardware", and strncmp returns
0 if there is a match, not 8.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 samsung-ipc/ipc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c
index 99a585a..f7e0379 100644
--- a/samsung-ipc/ipc.c
+++ b/samsung-ipc/ipc.c
@@ -74,7 +74,7 @@ int ipc_device_detect(void)
 
     line = strtok(buffer, "\n");
     while (line != NULL) {
-        if (strncmp(line, "Hardware", 8) == 8) {
+        if (strncmp(line, "Hardware", 8) == 0) {
             p = line + 11;
             c = p;
 
-- 
2.23.0



More information about the Replicant mailing list