Skip to content

Commit

Permalink
openrc-pam: change eerrorx to eerror
Browse files Browse the repository at this point in the history
Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
  • Loading branch information
navi-desu committed Jun 23, 2023
1 parent e12ddac commit 7870d59
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/openrc-pam/openrc-pam.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand Down

0 comments on commit 7870d59

Please sign in to comment.