Blame SOURCES/autofs-5.0.7-fix-fcntl-return-check.patch

4d476f
autofs-5.0.7 - fix fcntl return check
4d476f
4d476f
From: Ian Kent <raven@themaw.net>
4d476f
4d476f
When checking for FD_CLOEXEC support the return of the fcntl(2) call to
4d476f
get the file descriptor flags is not checked which could result in an
4d476f
incorrect result.
4d476f
---
4d476f
 include/automount.h |    3 ++-
4d476f
 1 file changed, 2 insertions(+), 1 deletion(-)
4d476f
4d476f
diff --git a/include/automount.h b/include/automount.h
4d476f
index e72fa0d..6ced842 100644
4d476f
--- a/include/automount.h
4d476f
+++ b/include/automount.h
4d476f
@@ -547,7 +547,8 @@ static inline void check_cloexec(int fd)
4d476f
 {
4d476f
 	if (cloexec_works == 0) {
4d476f
 		int fl = fcntl(fd, F_GETFD);
4d476f
-		cloexec_works = (fl & FD_CLOEXEC) ? 1 : -1;
4d476f
+		if (fl != -1)
4d476f
+			cloexec_works = (fl & FD_CLOEXEC) ? 1 : -1;
4d476f
 	}
4d476f
 	if (cloexec_works > 0)
4d476f
 		return;