aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-06-23 07:30:23 -0300
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-10-19 10:56:54 +0200
commitd2b65b7c93e33fb260346e7924cce23fdcef891a (patch)
tree0f2087d7be72c7bf63c4e7ade0d5cd2393f0f003
parenta0aa59b9a09ef4688510d345092f6c5292046cfc (diff)
openrc-pam: change eerrorx to eerror
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
-rw-r--r--src/openrc-pam/openrc-pam.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/openrc-pam/openrc-pam.c b/src/openrc-pam/openrc-pam.c
index 3e18699d..a9feadcb 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);