system: adb: fix shell service

Fix wrong dup2 return value check after:
fs: file_dup2 shouldn't hold the file list lock
1e5bfa623aa93b918566e8dc0e2f9c1a1037f45e

Fix issue in adb shell introduced in:
nsh: Pass the correct command lines to nsh_consolemain
6aca60133c663cae0de8fa31a64b472f8675fcbb
This commit is contained in:
Simon Piriou 2021-05-08 00:38:01 +02:00 committed by Xiang Xiao
parent 998abe1deb
commit e4db4df673

View File

@ -1,5 +1,5 @@
/****************************************************************************
* 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 */