From: Egor Date: Sun, 15 Jun 2025 05:04:08 +0000 (+0300) Subject: setpass: add error messages X-Git-Url: https://git.patchysicp.xyz/?a=commitdiff_plain;h=a4a72b83a2022654bfa277b361f85b476b6f9f74;p=patchyircd.git setpass: add error messages --- diff --git a/src/setpass.cpp b/src/setpass.cpp index 4aa4b41..c86d306 100644 --- a/src/setpass.cpp +++ b/src/setpass.cpp @@ -30,10 +30,16 @@ char *read_password(const char *prompt) int main(int argc, char **argv) { - if (argc < 3) + if (argc < 3) { + fprintf(stderr, "Usage: %s [username] [datafile.txt]\n", argv[0]); return 1; + } char *pass = read_password("password: "); if (!pass) return 1; - return -password_set(argv[1], pass, argv[2], "setpass.tmp"); + if (password_set(argv[1], pass, argv[2], "setpass.tmp") == -1) { + fprintf(stderr, "There was an error. Does %s exist?\n", argv[2]); + return 1; + } + return 0; }