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

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