From 7870d597d1f291ae198d40d738a160b922d51a1a Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Fri, 23 Jun 2023 07:30:23 -0300 Subject: [PATCH] openrc-pam: change eerrorx to eerror Signed-off-by: Anna (navi) Figueiredo Gomes --- src/openrc-pam/openrc-pam.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/openrc-pam/openrc-pam.c b/src/openrc-pam/openrc-pam.c index 3e18699df..a9feadcbf 100644 --- a/src/openrc-pam/openrc-pam.c +++ b/src/openrc-pam/openrc-pam.c @@ -26,15 +26,21 @@ inc_dec_lockfile(pam_handle_t *pamh, int val) lockfile = fopen(lockfile_path, "r+"); if (!lockfile) { lockfile = fopen(lockfile_path, "w+"); - if (!lockfile) - eerrorx("fopen: failed to open file %s, %s", lockfile_path, strerror(errno)); + if (!lockfile) { + eerror("fopen: failed to open file %s, %s", lockfile_path, strerror(errno)); + return -1; + } if (flock(fileno(lockfile), LOCK_EX) != 0) { - eerrorx("flock: %s", strerror(errno)); + eerror("flock: %s", strerror(errno)); + fclose(lockfile); + return -1; } locknum = 1; } else { if (flock(fileno(lockfile), LOCK_EX) != 0) { - eerrorx("flock: %s", strerror(errno)); + eerror("flock: %s", strerror(errno)); + fclose(lockfile); + return -1; } fscanf(lockfile, "%d", &locknum); locknum += val; @@ -46,7 +52,7 @@ inc_dec_lockfile(pam_handle_t *pamh, int val) fprintf(lockfile, "%d", locknum); if (flock(fileno(lockfile), LOCK_UN)) { - eerrorx("flock: %s", strerror(errno)); + eerror("flock: %s", strerror(errno)); } fclose(lockfile);