diff --git a/rdo.c b/rdo.c index 3325062..019310a 100644 --- a/rdo.c +++ b/rdo.c @@ -50,22 +50,23 @@ int main(int argc, char** argv) { if (argc < 2) errx(1, "Please specify a program to run"); + int ruid = getuid(); + if (ruid == 0) { + runprog(argc, argv); + return 0; + } + FILE* fp = fopen("/etc/rdo.conf", "r"); if (!fp) err(1, "Could not open /etc/rdo.conf"); - int ruid = getuid(); - if (ruid == 0) { - fclose(fp); - 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; + fclose(fp); + struct passwd* p = getpwnam(username); if (!p) err(1, "Could not get user info");