[Replicant] [libsamsung-ipc] [PATCH 1/2] nv_data-imei: handle missing command line arguments error

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Sun Nov 8 00:32:23 UTC 2020


Without that fix we have:
    $ ./tools/nv_data-imei nv_data.bin bruteforce-imei
    IMEI option required
    See nv_data-imei bruteforce-imei -h for more details.
    errno_to_sysexit: error: unknown error code -22.
    errno_to_sysexit: error code -22 needs to be implemented
    lt-nv_data-imei: nv_data-imei.c:823: errno_to_sysexit: Assertion `false' failed.
    Aborted (core dumped)
instead of:
    $ ./tools/nv_data-imei nv_data.bin bruteforce-imei
    IMEI option required
    See nv_data-imei bruteforce-imei -h for more details.

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

diff --git a/tools/nv_data-imei.c b/tools/nv_data-imei.c
index 526035f..b406f34 100644
--- a/tools/nv_data-imei.c
+++ b/tools/nv_data-imei.c
@@ -816,6 +816,8 @@ static int errno_to_sysexit(int err)
 		return EX_OK;
 	case EACCES:
 		return EX_NOINPUT;
+	case -EINVAL:
+		return EX_USAGE;
 	default:
 		printf("%s: error: unknown error code %d.\n", __func__, err);
 		printf("%s: error code %d needs to be implemented\n", __func__,
-- 
2.29.0



More information about the Replicant mailing list