bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

5.0.11 is missing #ifdefs on CLOEXEC


From: H.Merijn Brand
Subject: 5.0.11 is missing #ifdefs on CLOEXEC
Date: Fri, 22 Nov 2019 16:04:19 +0100

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/

Attachment: pgpWY5zTYLfsZ.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]