Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error codes from write are not detected #168

Closed
ifsnop opened this issue Nov 5, 2020 · 1 comment
Closed

error codes from write are not detected #168

ifsnop opened this issue Nov 5, 2020 · 1 comment

Comments

@ifsnop
Copy link
Contributor

ifsnop commented Nov 5, 2020

Detecting when parsing asterix output with pipes.

engine/stddevice.cxx:76

size_t bytesWrote = write(STDOUT_FILENO, pData, bytesLeft);
if (bytesWrote < 0) {

In case of error when writing, code path won't enter inside "if", because size_t is not signed, and errors from write are returned with -1

The error that bite me was EPIPE, when writing to a closed pipe.

Please replace size_t with ssize_t

Same error is also inside engine/serialdevice.cxx

@dsalantic
Copy link
Contributor

OK, done. tnx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants