Commit 90102b22 authored by Andrey Borzenkov's avatar Andrey Borzenkov Committed by Lennart Poettering
Browse files

pam: do not leak file descriptor if flock fails

If flock fails, fd is not returned to caller so it cannot clean up.
parent 756a8d17
......@@ -198,8 +198,12 @@ static int open_file_and_lock(const char *fn) {
* as the filesystems in question should be local, and only
* locally accessible, and most likely even tmpfs. */
if (flock(fd, LOCK_EX) < 0)
return -errno;
if (flock(fd, LOCK_EX) < 0) {
int r = -errno;
return r;
return fd;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment