You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2020/12/15 22:56:05 UTC
[incubator-nuttx-apps] branch master updated: nshlib: Remove fdopen
for the stdin, stdout and stderr
This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 28362eb nshlib: Remove fdopen for the stdin, stdout and stderr
28362eb is described below
commit 28362eb6d19f71b7aa9a308d6fff80e8ecfee7e1
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Dec 15 15:34:56 2020 +0800
nshlib: Remove fdopen for the stdin, stdout and stderr
not really need since these file stream should be opened automatically
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
nshlib/nsh_console.c | 23 -----------------------
nshlib/nsh_usbconsole.c | 11 -----------
2 files changed, 34 deletions(-)
diff --git a/nshlib/nsh_console.c b/nshlib/nsh_console.c
index 89f95e8..8489d0d 100644
--- a/nshlib/nsh_console.c
+++ b/nshlib/nsh_console.c
@@ -481,29 +481,6 @@ FAR struct console_stdio_s *nsh_newconsole(void)
pstate->cn_vtbl.redirect = nsh_consoleredirect;
pstate->cn_vtbl.undirect = nsh_consoleundirect;
-#if 0
- /* (Re-) open the console input device */
-
-#ifdef CONFIG_NSH_ALTCONDEV
- pstate->cn_confd = open(CONFIG_NSH_ALTSTDIN, O_RDWR);
- if (pstate->cn_confd < 0)
- {
- free(pstate);
- return NULL;
- }
-
- /* Create a standard C stream on the console device */
-
- pstate->cn_constream = fdopen(pstate->cn_confd, "r+");
- if (!pstate->cn_constream)
- {
- close(pstate->cn_confd);
- free(pstate);
- return NULL;
- }
-#endif
-#endif /* if 0 */
-
/* Initialize the error stream */
pstate->cn_errfd = ERRFD(pstate);
diff --git a/nshlib/nsh_usbconsole.c b/nshlib/nsh_usbconsole.c
index ee38e6d..2caafee 100644
--- a/nshlib/nsh_usbconsole.c
+++ b/nshlib/nsh_usbconsole.c
@@ -87,17 +87,6 @@ static void nsh_configstdio(int fd)
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
-
- /* fdopen to get the stdin, stdout and stderr streams.
- *
- * fd = 0 is stdin (read-only)
- * fd = 1 is stdout (write-only, append)
- * fd = 2 is stderr (write-only, append)
- */
-
- fdopen(0, "r");
- fdopen(1, "a");
- fdopen(2, "a");
}
/****************************************************************************