Merge pull request 'Add dependencies and fixed whitespace' (#2) from remoof/rdo:patch into main

Reviewed-on: https://codeberg.org/sw1tchbl4d3/rdo/pulls/2
This commit is contained in:
sw1tchbl4d3 2021-07-15 14:54:15 +02:00
commit c5469393ab
2 changed files with 7 additions and 4 deletions

View file

@ -30,3 +30,6 @@ sudo make uninstall
```sh
rdo [command]
```
### Dependencies
- `libbsd`

8
rdo.c
View file

@ -38,7 +38,7 @@ void runprog(int argc, char** argv) {
if (setgid(0) == -1)
err(1, "Could not setgid");
if (execvp(argv[0], argv) != 0)
if (execvp(argv[0], argv) != 0)
perror(argv[0]);
}
@ -51,7 +51,7 @@ int main(int argc, char** argv) {
errx(1, "Please specify a program to run");
FILE* fp = fopen("/etc/rdo.conf", "r");
if (!fp)
err(1, "Could not open /etc/rdo.conf");
@ -61,7 +61,7 @@ int main(int argc, char** argv) {
runprog(argc, argv);
return 0;
}
getconf(fp, "username", username, sizeof(username));
getconf(fp, "wrong_pw_sleep", wrong_pw_sleep, sizeof(wrong_pw_sleep));
sleep_ms = atoi(wrong_pw_sleep) * 1000;
@ -89,7 +89,7 @@ int main(int argc, char** argv) {
runprog(argc, argv);
return 0;
}
usleep(sleep_ms);
fprintf(stderr, "Wrong password.\n");
tries++;