Skip to content

Commit

Permalink
Fix #945, shell implementation on posix and rtems
Browse files Browse the repository at this point in the history
Due to other changes the shell implementation on RTEMS and POSIX failed
to build under certain configurations.  This fixes and verifies the
shell functions as expected.
  • Loading branch information
jphickey committed Apr 7, 2021
1 parent 65c584f commit 7710202
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 96 deletions.
5 changes: 3 additions & 2 deletions src/os/posix/src/os-impl-shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "os-posix.h"
#include "os-impl-io.h"

#include "os-shared-file.h"
#include "os-shared-shell.h"
#include "os-shared-idmap.h"

Expand All @@ -60,7 +61,7 @@
int32 OS_ShellOutputToFile_Impl(const OS_object_token_t *token, const char *Cmd)
{
pid_t cpid;
uint32 local_id;
osal_index_t local_id;
int wstat;
const char * shell = getenv("SHELL");
OS_impl_file_internal_record_t *impl;
Expand Down Expand Up @@ -88,7 +89,7 @@ int32 OS_ShellOutputToFile_Impl(const OS_object_token_t *token, const char *Cmd)
/* close all _other_ filehandles */
for (local_id = 0; local_id < OS_MAX_NUM_OPEN_FILES; ++local_id)
{
if (OS_global_stream_table[local_id].active_id != 0)
if (OS_ObjectIdIsValid(OS_global_stream_table[local_id].active_id))
{
close(OS_impl_filehandle_table[local_id].fd);
}
Expand Down
13 changes: 4 additions & 9 deletions src/os/rtems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,10 @@ set(RTEMS_IMPL_SRCLIST
../portable/os-impl-posix-dirs.c
)

if (OSAL_CONFIG_INCLUDE_SHELL)
list(APPEND RTEMS_IMPL_SRCLIST
src/os-impl-shell.c
)
else ()
list(APPEND RTEMS_IMPL_SRCLIST
../portable/os-impl-no-shell.c
)
endif ()
# Currently the "shell output to file" for RTEMS is not implemented
list(APPEND RTEMS_IMPL_SRCLIST
../portable/os-impl-no-shell.c
)

# If some form of module loading is configured,
# then build the module loader
Expand Down
85 changes: 0 additions & 85 deletions src/os/rtems/src/os-impl-shell.c

This file was deleted.

0 comments on commit 7710202

Please sign in to comment.