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

'no password' condition needs an error code instead of success #87

Open
SecretAgentOne opened this issue Feb 22, 2022 · 0 comments
Open

Comments

@SecretAgentOne
Copy link

When no password is provided (either by -P or by MCRCON_PASS environment), mcrcon fails to perform the requested action but has a success return code. Instead the program should return EXIT_FAILURE. Below is a patch.

:~/git/mcrcon$ git diff HEAD^
diff --git a/mcrcon.c b/mcrcon.c
index 79c8aba..d3c8874 100644
--- a/mcrcon.c
+++ b/mcrcon.c
@@ -209,7 +209,7 @@ int main(int argc, char *argv[])
 
        if (pass == NULL) {
                puts("You must give password (-p password).\nTry 'mcrcon -h' or 'man mcrcon' for help.");
-               return 0;
+               exit(EXIT_FAILURE);
        }
 
        if(optind == argc && terminal_mode == 0)
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

1 participant