From e4db4df673430101f6925fefd532ae1f6fc69488 Mon Sep 17 00:00:00 2001 From: Simon Piriou Date: Sat, 8 May 2021 00:38:01 +0200 Subject: [PATCH] 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 --- system/adb/shell_pipe.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/system/adb/shell_pipe.c b/system/adb/shell_pipe.c index 762476bab..a3dc6b1a1 100644 --- a/system/adb/shell_pipe.c +++ b/system/adb/shell_pipe.c @@ -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 */