Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15625

5.0.11 is missing #ifdefs on CLOEXEC

From "H.Merijn Brand" <h.m.brand@xs4all.nl>
Newsgroups gnu.bash.bug
Subject 5.0.11 is missing #ifdefs on CLOEXEC
Date 2019-11-22 16:04 +0100
Message-ID <mailman.2336.1574436371.13325.bug-bash@gnu.org> (permalink)
References <20191122160419.01afd860@pc09.procura.nl>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

HP-UX 11.23/ia64 using GNU gcc-4.6.1 does not know about O_CLOEXEC

--8<---
--- examples/loadables/fdflags.c.org    2019-11-22 16:03:07 +0000
+++ examples/loadables/fdflags.c        2019-11-22 16:00:54 +0000
@@ -113,8 +113,10 @@ getflags(int fd, int p)
       return -1;
     }

+#ifdef O_CLOEXEC
   if (c)
     f |= O_CLOEXEC;
+#endif

   return f & getallflags();
 }
@@ -199,16 +201,20 @@ setone(int fd, char *v, int verbose)
   parseflags(v, &pos, &neg);

   cloexec = -1;
+#ifdef O_CLOEXEC
   if ((pos & O_CLOEXEC) && (f & O_CLOEXEC) == 0)
     cloexec = FD_CLOEXEC;
   if ((neg & O_CLOEXEC) && (f & O_CLOEXEC))
     cloexec = 0;
+#endif
   if (cloexec != -1 && fcntl(fd, F_SETFD, cloexec) == -1)
     builtin_error("can't set status for fd %d: %s", fd, strerror(errno));

+#ifdef O_CLOEXEC
   pos &= ~O_CLOEXEC;
   neg &= ~O_CLOEXEC;
   f &= ~O_CLOEXEC;
+#endif

   n = f;
   n |= pos;
-->8---

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.31      porting perl5 on HP-UX, AIX, and Linux
https://useplaintext.email  https://tux.nl  http://www.test-smoke.org
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

5.0.11 is missing #ifdefs on CLOEXEC "H.Merijn Brand" <h.m.brand@xs4all.nl> - 2019-11-22 16:04 +0100

csiph-web