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

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