Changeset 95036a45 in rtems
- Timestamp:
- 08/08/20 08:07:32 (4 years ago)
- Branches:
- 5
- Children:
- e95c00a7
- Parents:
- 534f9dbe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/libmisc/shell/shell.c
r534f9dbe r95036a45 235 235 if (eno != 0) 236 236 rtems_error(0, "pthread_setspecific(shell_current_env_key): clear"); 237 238 /* 239 * Clear stdin and stdout file pointers of they will be closed 240 */ 237 } 238 239 /* 240 * Clear stdin, stdout and stderr file pointers so they will not be closed. 241 */ 242 static void rtems_shell_clear_shell_std_handles(void) 243 { 241 244 stdin = NULL; 242 245 stdout = NULL; 246 stderr = NULL; 243 247 } 244 248 … … 776 780 if ( !shell_env ) { 777 781 printk( "shell_env is NULL\n" ); 782 778 783 return; 779 784 } … … 798 803 rtems_id wake_on_end = shell_env->wake_on_end; 799 804 rtems_shell_main_loop( shell_env ); 805 rtems_shell_clear_shell_std_handles(); 800 806 if (wake_on_end != RTEMS_INVALID_ID) 801 807 rtems_event_send (wake_on_end, RTEMS_EVENT_1); … … 873 879 stdout = stderr; 874 880 } else if (strcmp(shell_env->output, "/dev/null") == 0) { 881 if (stdout == NULL) { 882 fprintf(stderr, "shell: stdout is NULLs\n"); 883 rtems_shell_clear_shell_env(); 884 return false; 885 } 875 886 fclose (stdout); 876 887 } else { … … 907 918 908 919 if (!input_file) { 920 if (stdin == NULL) { 921 fprintf(stderr, "shell: stdin is NULLs\n"); 922 if (stdoutToClose != NULL) 923 fclose(stdoutToClose); 924 rtems_shell_clear_shell_env(); 925 return false; 926 } 909 927 /* Make a raw terminal, Linux Manuals */ 910 928 if (tcgetattr(fileno(stdin), &previous_term) >= 0) { … … 968 986 */ 969 987 if (shell_env->login_check != NULL) { 970 result = rtems_shell_login(shell_env, stdin, stdout);988 result = rtems_shell_login(shell_env, stdin, stdout); 971 989 } else { 972 990 setuid(shell_env->uid);
Note: See TracChangeset
for help on using the changeset viewer.