JianyuWang0623 opened a new pull request, #3558:
URL: https://github.com/apache/nuttx-apps/pull/3558
## Summary
This PR contains two fixes for the `rexecd`/`rexec` utilities under
`netutils/`.
1. **netutils/rexecd: use dpopen() instead of popen() to get raw fd**
`popen()` now returns a `fopencookie()`-backed `FILE*`. On such a stream
`fileno()` returns the cookie pointer instead of a real file descriptor,
which is typically negative. `rexecd`'s relay loop feeds that value into
`poll()`, where a negative `fd` is silently ignored, so the loop never
sees
the child's `POLLIN`/`POLLHUP`/EOF and blocks forever waiting for the
command
to finish. (Related upstream change: apache/nuttx-apps#3511.)
3. **netutils/rexec: initialize ret to avoid maybe-uninitialized**
## Impact
- **Users**: `rexecd` no longer hangs after the remote command finishes; the
command-completion (EOF/`POLLHUP`) path works again. No API or CLI change.
- **Build**: removes a potential `-Werror=maybe-uninitialized` build break in
`rexec.c`.
- **Dependencies**: `rexecd` now depends on `dpopen()`/`dpclose()`
(`CONFIG_SYSTEM_POPEN`), the descriptor-based counterparts of
`popen()`/`pclose()`.
- **Hardware / Security / Compatibility**: no change. Documentation: none
needed.
## Testing
Built with the standard nuttx-apps toolchain; warning-as-error build of
`netutils/rexec` and `netutils/rexecd` passes after the `ret` initialization
fix.
Runtime verified by running `rexecd` on the target and issuing a remote
command
from `rexec`:
- Before: `rexec <host> <cmd>` printed the command output but then hung; the
session never returned to the prompt because `poll()` ignored the negative
`fileno()` and the relay loop never observed command completion.
- After: the same `rexec <host> <cmd>` prints the output, receives
EOF/`POLLHUP`
when the child exits, and the session terminates cleanly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]