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

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