From d2b65b7c93e33fb260346e7924cce23fdcef891a Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Fri, 23 Jun 2023 07:30:23 -0300 Subject: 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(-) (limited to 'src/openrc-pam/openrc-pam.c') 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); -- cgit v1.2.3