wireless/wapi/src/wapi.c: When executing a command return it's error code on failure.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2021-04-12 10:11:05 +02:00 committed by Xiang Xiao
parent dd38c7f920
commit fbf5290401

View File

@ -1025,6 +1025,7 @@ int main(int argc, FAR char *argv[])
FAR const struct wapi_command_s *wapicmd; FAR const struct wapi_command_s *wapicmd;
int sock; int sock;
int i; int i;
int ret;
/* Get the command */ /* Get the command */
@ -1084,7 +1085,8 @@ int main(int argc, FAR char *argv[])
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if (wapicmd->handler(sock, argc - 2, argc == 2 ? NULL : &argv[2]) < 0) ret = wapicmd->handler(sock, argc - 2, argc == 2 ? NULL : &argv[2]);
if (ret < 0)
{ {
WAPI_ERROR("ERROR: Process command (%s) failed.\n", cmdname); WAPI_ERROR("ERROR: Process command (%s) failed.\n", cmdname);
} }
@ -1092,5 +1094,5 @@ int main(int argc, FAR char *argv[])
/* Close communication socket */ /* Close communication socket */
close(sock); close(sock);
return EXIT_SUCCESS; return ret;
} }