summaryrefslogtreecommitdiff
path: root/shells/bash/patches/patch-examples_loadables_fdflags.c
blob: 1ad139b07734ac98cdf06226ef25b17b7a3c86e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$NetBSD: patch-examples_loadables_fdflags.c,v 1.1 2019/02/28 07:20:57 maya Exp $

Handle O_CLOEXEC not being defined (Solaris 10)

--- examples/loadables/fdflags.c.orig	2017-02-02 16:40:42.000000000 +0000
+++ examples/loadables/fdflags.c
@@ -113,8 +113,11 @@ getflags(int fd, int p)
       return -1;
     }
 
-  if (c)
+  if (c) {
+#ifdef O_CLOEXEC
     f |= O_CLOEXEC;
+#endif
+  }
 
   return f & getallflags();
 }
@@ -198,6 +201,7 @@ setone(int fd, char *v, int verbose)
 
   parseflags(v, &pos, &neg);
 
+#ifdef O_CLOEXEC
   cloexec = -1;
   if ((pos & O_CLOEXEC) && (f & O_CLOEXEC) == 0)
     cloexec = FD_CLOEXEC;
@@ -209,6 +213,7 @@ setone(int fd, char *v, int verbose)
   pos &= ~O_CLOEXEC;
   neg &= ~O_CLOEXEC;
   f &= ~O_CLOEXEC;
+#endif
 
   n = f;
   n |= pos;