rpms/autofs/F-10 autofs-5.0.3-use-CLOEXEC-flag-setmntent.patch, NONE, 1.1 autofs.spec, 1.259, 1.260

Ian Kent iankent at fedoraproject.org
Thu Feb 5 07:10:16 UTC 2009


Author: iankent

Update of /cvs/pkgs/rpms/autofs/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13404

Modified Files:
	autofs.spec 
Added Files:
	autofs-5.0.3-use-CLOEXEC-flag-setmntent.patch 
Log Message:
* Thu Feb 5 2009 Ian Kent <ikent at redhat.com> - 5.0.3-39
- use CLOEXEC flag functionality for setmntent also, if present.


autofs-5.0.3-use-CLOEXEC-flag-setmntent.patch:

--- NEW FILE autofs-5.0.3-use-CLOEXEC-flag-setmntent.patch ---
autofs-5.0.4 - use CLOEXEC flag for setmntent

From: Ian Kent <raven at themaw.net>

Update use of CLOEXEC functionality to cover setmntent(3)
calls as well.
---

 include/automount.h |   20 ++++++++++++++++++++
 lib/mounts.c        |    8 ++++----
 2 files changed, 24 insertions(+), 4 deletions(-)


--- autofs-5.0.3.orig/include/automount.h
+++ autofs-5.0.3/include/automount.h
@@ -570,5 +570,25 @@ static inline FILE *open_fopen_r(const c
 	return f;
 }
 
+static inline FILE *open_setmntent_r(const char *table)
+{
+	FILE *tab;
+
+#if defined(O_CLOEXEC) && defined(SOCK_CLOEXEC)
+	if (cloexec_works != -1) {
+		tab = setmntent(table, "re");
+		if (tab != NULL) {
+			check_cloexec(fileno(tab));
+			return tab;
+		}
+	}
+#endif
+	tab = fopen(table, "r");
+	if (tab == NULL)
+		return NULL;
+	check_cloexec(fileno(tab));
+	return tab;
+}
+
 #endif
 
--- autofs-5.0.3.orig/lib/mounts.c
+++ autofs-5.0.3/lib/mounts.c
@@ -209,7 +209,7 @@ struct mnt_list *get_mnt_list(const char
 	if (!path || !pathlen || pathlen > PATH_MAX)
 		return NULL;
 
-	tab = setmntent(table, "r");
+	tab = open_setmntent_r(table);
 	if (!tab) {
 		char *estr = strerror_r(errno, buf, PATH_MAX - 1);
 		logerr("setmntent: %s", estr);
@@ -406,7 +406,7 @@ int is_mounted(const char *table, const 
 	if (!path || !pathlen || pathlen >= PATH_MAX)
 		return 0;
 
-	tab = setmntent(table, "r");
+	tab = open_setmntent_r(table);
 	if (!tab) {
 		char *estr = strerror_r(errno, buf, PATH_MAX - 1);
 		logerr("setmntent: %s", estr);
@@ -451,7 +451,7 @@ int has_fstab_option(const char *opt)
 	if (!opt)
 		return 0;
 
-	tab = setmntent(_PATH_MNTTAB, "r");
+	tab = open_setmntent_r(_PATH_MNTTAB);
 	if (!tab) {
 		char *estr = strerror_r(errno, buf, PATH_MAX - 1);
 		logerr("setmntent: %s", estr);
@@ -630,7 +630,7 @@ struct mnt_list *tree_make_mnt_tree(cons
 	size_t plen;
 	int eq;
 
-	tab = setmntent(table, "r");
+	tab = open_setmntent_r(table);
 	if (!tab) {
 		char *estr = strerror_r(errno, buf, PATH_MAX - 1);
 		logerr("setmntent: %s", estr);


Index: autofs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/autofs/F-10/autofs.spec,v
retrieving revision 1.259
retrieving revision 1.260
diff -u -r1.259 -r1.260
--- autofs.spec	22 Jan 2009 05:52:45 -0000	1.259
+++ autofs.spec	5 Feb 2009 07:09:46 -0000	1.260
@@ -4,7 +4,7 @@
 Summary: A tool for automatically mounting and unmounting filesystems
 Name: autofs
 Version: 5.0.3
-Release: 38
+Release: 39
 Epoch: 1
 License: GPLv2+
 Group: System Environment/Daemons
@@ -71,6 +71,7 @@
 Patch59: autofs-5.0.3-fix-bad-alloca-usage.patch
 Patch60: autofs-5.0.4-fix-dumb-libxml2-check.patch
 Patch61: autofs-5.0.3-use-CLOEXEC-flag.patch
+Patch62: autofs-5.0.3-use-CLOEXEC-flag-setmntent.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs
 Requires: kernel >= 2.6.17
@@ -173,6 +174,7 @@
 %patch59 -p1
 %patch60 -p1
 %patch61 -p1
+%patch62 -p1
 
 %build
 #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -225,6 +227,9 @@
 %{_libdir}/autofs/
 
 %changelog
+* Thu Feb 5 2009 Ian Kent <ikent at redhat.com> - 5.0.3-39
+- use CLOEXEC flag functionality for setmntent also, if present.
+
 * Wed Jan 21 2009 Ian Kent <kent at redhat.com> - 5.0.3-38
 - use CLOEXEC flag functionality if present.
 




More information about the fedora-extras-commits mailing list