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

improve simpleParser error detection #27

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

kupsch
Copy link
Contributor

@kupsch kupsch commented Apr 10, 2024

exit -1 if the symtab object failed to be constructed such as when the path is a non-elf or unreadable file

exit -1 if the symtab object failed to be constructed such as
when the path is a non-elf or unreadable file
@kupsch kupsch added the enhancement New feature or request label Apr 10, 2024
@kupsch kupsch requested a review from hainest April 10, 2024 05:27
@kupsch
Copy link
Contributor Author

kupsch commented Apr 10, 2024

@hainest do you know if there any reason that -1 is used for the error exit status; the exit status is an unsigned 8-bit value so it turns into 255. 1 would be a better choice as shells return 128+n if signal number n causes the exit, so number below 128 are better choices.

@n738cu
Copy link

n738cu commented Apr 10, 2024 via email

@hainest
Copy link
Contributor

hainest commented Apr 10, 2024

@hainest do you know if there any reason that -1 is used for the error exit status; the exit status is an unsigned 8-bit value so it turns into 255. 1 would be a better choice as shells return 128+n if signal number n causes the exit, so number below 128 are better choices.

I like to use -1 because it sticks out in the code better than any other non-zero number and doesn't require using stdlib.h for EXIT_FAILURE. I know that it doesn't follow the convention of indicating termination via a signal, but vanishingly few people are ever going to care. You can change it, if it's bothersome.

@hainest
Copy link
Contributor

hainest commented Apr 10, 2024

exit -1 if the symtab object failed to be constructed such as when the path is a non-elf or unreadable file

Leaving a note for posterity. This also fails for archive files because Symtab::openFile doesn't check for them correctly.

@kupsch kupsch merged commit d84c9ea into master Apr 10, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants