Skip to content

Conversation

@Frozen935
Copy link

@Frozen935 Frozen935 commented Jan 21, 2026

avoid double-close of redirection fds

Summary

Fix a double close() in foreground redirection. nsh_undirect() already closes the redirected fd_in/fd_out, but close_redir would close them again. Reset fd_in/fd_out to -1 after nsh_undirect() to avoid closing the same fd twice.

Impact

nsh_redirect.

Testing

# NSH Script
echo "start" > /tmp/test.log
help >> /tmp/test.log
cat < /tmp/test.log

avoid double-close of redirection fds

Signed-off-by: zhenwei fang <fangzhenwei@bytedance.com>
@Frozen935 Frozen935 marked this pull request as ready for review January 21, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants