system: adb: fix shell service
Fix wrong dup2 return value check after:
fs: file_dup2 shouldn't hold the file list lock
Fix issue in adb shell introduced in:
nsh: Pass the correct command lines to nsh_consolemain
/****************************************************************************
- * system/adb/shell_pipe.c
+ * apps/system/adb/shell_pipe.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -187,7 +187,7 @@ int shell_pipe_exec(char * const argv[], shell_pipe_t *apipe,
/* Setup stdout (read: adb, write: child) */
ret = dup2(out_fds[1], 1);
- assert(ret == 0);
+ assert(ret == 1);
ret = close(out_fds[1]);
assert(ret == 0);
@@ -229,8 +229,9 @@ int shell_pipe_exec(char * const argv[], shell_pipe_t *apipe,
/* Create shell process */
ret = task_create("ADB shell", CONFIG_SYSTEM_NSH_PRIORITY,
- CONFIG_SYSTEM_NSH_STACKSIZE, nsh_consolemain,
- &argv[1]);
+ CONFIG_SYSTEM_NSH_STACKSIZE,
+ argv ? nsh_system : nsh_consolemain,
+ argv);
/* Close stdin and stdout */
