From ac383e788446e54c4b9ffc01496dfac958644dcf Mon Sep 17 00:00:00 2001 From: erik Date: Fri, 9 Jan 2009 11:21:07 +0000 Subject: [PATCH] Set errno to 0, fixes some problems while parsing RFPI. git-svn-id: https://dedected.org/svn/trunk@32 8d8ab74c-27aa-4a3d-9bde-523a2bc1f624 --- com-on-air_cs-linux/tools/dect_cli.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/com-on-air_cs-linux/tools/dect_cli.c b/com-on-air_cs-linux/tools/dect_cli.c index 48cf050..3cc314d 100644 --- a/com-on-air_cs-linux/tools/dect_cli.c +++ b/com-on-air_cs-linux/tools/dect_cli.c @@ -214,18 +214,19 @@ void do_ppscan_str(char * str_rfpi) uint8_t RFPI[5]; char * end; int i; + errno = 0; for (i=0; i<5; i++) { RFPI[i] = strtoul(str_rfpi, &end, 16); if ((errno == ERANGE ) || (errno != 0 && RFPI[i] == 0)) { - LOG("!!! please enter a valid RFPI (e.g. 00 01 02 03 04)\n"); + LOG("!!! please enter a valid RFPI (e.g. 00 01 02 03 04) RFPI out of range\n"); return; } if (end == str_rfpi) { - LOG("!!! please enter a valid RFPI (e.g. 00 01 02 03 04)\n"); + LOG("!!! please enter a valid RFPI (e.g. 00 01 02 03 04) RFPI too short\n"); return; } str_rfpi = end;