-
Notifications
You must be signed in to change notification settings - Fork 252
Simplify error handling (mainly, error messages) #1314
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
Draft
alejandro-colomar
wants to merge
19
commits into
shadow-maint:master
Choose a base branch
from
alejandro-colomar:serr
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1144e9d to
18af936
Compare
18af936 to
7474300
Compare
7474300 to
dc7f8c0
Compare
b09744d to
28170d7
Compare
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
This will allow having shorter lines for writing to stderr. This name is commonly used in other projects, it seems (see link below). Link: <https://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/Variadic-Macros.html> Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
The double parentheses were used to fake a variadic macro with a non-variadic one. With a variadic macro, we remove the weird double parentheses that were needed to call this macro, which BTW were error-prone (see the bug fixed in the previous commit). Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
The name of this macro makes it more evident what it does. It's a C-locale version of syslog(3). We need to implement it as a macro so that arguments such as strerror(3) are evaluated after setting the C locale. This would be impossible with a function. Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
There's no need for two variables, and this avoids one assignment. Signed-off-by: Alejandro Colomar <[email protected]>
…nally Both setlocale(3) and free(3) are okay to call with a null pointer. Signed-off-by: Alejandro Colomar <[email protected]>
This function preserves errno, so that a following syslog(3) call still has the previous errno value. Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Having such long and complex format strings and variadic arguments is error-prone, as can be seen in the previous commit, which fixes a bug of this kind. Signed-off-by: Alejandro Colomar <[email protected]>
Print simpler messages that don't need translation. Check libc errors with ==-1 and ==NULL instead of <0 (or !=0) and !p. Signed-off-by: Alejandro Colomar <[email protected]>
28170d7 to
691c3fd
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Queued after #1289 .