[Replicant] [libsamsung-ipc] [PATCH 4/4] tools: fix nv-data-md5 compilation with Replicant 6

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Wed Mar 17 17:37:41 UTC 2021


When compiling nv-data-md5 under Replicant 6 we have:
    hardware/replicant/libsamsung-ipc/tools/nv_data-md5.c:
    In function 'main':
    hardware/replicant/libsamsung-ipc/tools/nv_data-md5.c:103:1:
    error:
    control reaches end of non-void function [-Werror=return-type]
     }
     ^
    cc1: some warnings being treated as errors

So we simply need to add a return in the error path.

While we're at it, we use an exit code referenced in sysexits.h
to follow a standard. This can help differentiating between
different types of errors.

Thanks to that, it can also simplify the code when writing tests.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 tools/nv_data-md5.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/nv_data-md5.c b/tools/nv_data-md5.c
index e8c9fc8..5edb257 100644
--- a/tools/nv_data-md5.c
+++ b/tools/nv_data-md5.c
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sysexits.h>
 
 #include <sys/types.h>
 
@@ -100,4 +101,6 @@ int main(int argc, char *argv[])
 error:
 	if (client != NULL)
 		ipc_client_destroy(client);
+
+	return EX_SOFTWARE;
 }
-- 
2.30.1



More information about the Replicant mailing list