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

r.compress: Reversing logic to fix Failure Reporting #1812

Merged
merged 2 commits into from
Aug 22, 2021

Conversation

Lucifergene
Copy link
Contributor

Currently when recompressing data from one compression to another, everything works but we still get Exit 1 status.
This PR reverses the logic of the EXIT_FAILURE and EXIT_SUCCESS status, which fixes #1802.

@@ -96,7 +96,7 @@ int main(int argc, char *argv[])

stat = EXIT_FAILURE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic needs to be reversed differently: process() returns 0 on success, 1 on failure. We expect success. If any call to process() fails, we need to exit with EXIT_FAILURE. Thus

    stat = EXIT_SUCCESS;
    for (n = 0; (name = map->answers[n]); n++)
	if (process(name, uncompress->answer))
	    stat = EXIT_FAILURE;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@metzm Thanks for the explanation.
I am changing the code accordingly.

@petrasovaa
Copy link
Contributor

Thanks for your contribution!

@neteler neteler added this to the 7.8.6 milestone Dec 9, 2021
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
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

Successfully merging this pull request may close these issues.

[Bug] r.compress returns EXIT_FAILURE incorrectly
4 participants