summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/022-add-close-on-exec-descriptors.patch
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:14:24 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:29:45 +0100
commit29d6678fd546377459ef75cf54abeef5b969b5cf (patch)
tree8edd65790e37a00d01c3f203f773fe4b5012db18 /meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/022-add-close-on-exec-descriptors.patch
parentda49de6885ee1bc424e70bc02f21f6ab920efb55 (diff)
downloadpoky-29d6678fd546377459ef75cf54abeef5b969b5cf.tar.gz
Major layout change to the packages directory
Having one monolithic packages directory makes it hard to find things and is generally overwhelming. This commit splits it into several logical sections roughly based on function, recipes.txt gives more information about the classifications used. The opportunity is also used to switch from "packages" to "recipes" as used in OpenEmbedded as the term "packages" can be confusing to people and has many different meanings. Not all recipes have been classified yet, this is just a first pass at separating things out. Some packages are moved to meta-extras as they're no longer actively used or maintained. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/022-add-close-on-exec-descriptors.patch')
-rw-r--r--meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/022-add-close-on-exec-descriptors.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/022-add-close-on-exec-descriptors.patch b/meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/022-add-close-on-exec-descriptors.patch
new file mode 100644
index 0000000000..011ae74cde
--- /dev/null
+++ b/meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/022-add-close-on-exec-descriptors.patch
@@ -0,0 +1,61 @@
1# Force socket fds to close on exec when used in conjunction with pseudo
2# Patch origin: Wind River
3
4---
5 nfsd.c | 8 ++++++++
6 rpcmisc.c | 9 +++++++++
7 ugidd.c | 8 ++++++++
8 3 files changed, 25 insertions(+)
9
10--- a/nfsd.c
11+++ b/nfsd.c
12@@ -630,6 +630,14 @@ nfsd_nfsproc_create_2(createargs *argp,
13 if (S_ISSOCK(argp->attributes.mode)) {
14 if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
15 return(nfs_errno());
16+ /* if there is a pseudo exec mark the socket to be
17+ * closed automatically
18+ */
19+ {
20+ long f_flags;
21+ f_flags = fcntl(s, F_GETFD);
22+ f_flags = fcntl(s, F_SETFD, f_flags | FD_CLOEXEC);
23+ }
24 sa.sun_family = AF_UNIX;
25 strncpy(sa.sun_path, pathbuf, sizeof(sa.sun_path));
26 sa.sun_path[sizeof(sa.sun_path)-1] = '\0';
27--- a/rpcmisc.c
28+++ b/rpcmisc.c
29@@ -197,6 +197,15 @@ makesock(int port, int proto, int socksz
30 Dprintf(L_FATAL, "Could not make a %s socket: %s\n",
31 prot_name, strerror(errno));
32
33+ /* if there is a pseudo exec mark the socket to be
34+ * closed automatically
35+ */
36+ {
37+ long f_flags;
38+ f_flags = fcntl(s, F_GETFD);
39+ f_flags = fcntl(s, F_SETFD, f_flags | FD_CLOEXEC);
40+ }
41+ fcntl(s, FD_CLOEXEC, 1);
42 memset((char *) &sin, 0, sizeof(sin));
43 sin.sin_family = AF_INET;
44 sin.sin_addr.s_addr = INADDR_ANY;
45--- a/ugidd.c
46+++ b/ugidd.c
47@@ -195,6 +195,14 @@ authenticate_1_svc(argp, rqstp)
48 destaddr.sin_port = htons(*argp);
49 if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
50 goto bad;
51+ /* if there is a pseudo exec mark the socket to be
52+ * closed automatically
53+ */
54+ {
55+ long f_flags;
56+ f_flags = fcntl(s, F_GETFD);
57+ f_flags = fcntl(s, F_SETFD, f_flags | FD_CLOEXEC);
58+ }
59 setsockopt(s, SOL_SOCKET, SO_LINGER, 0, 0);
60 bzero((char *) &sendaddr, sizeof sendaddr);
61 /* find a reserved port */