1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +00:00

Fix build on systems without O_CLOEXEC (re: 9f43f8d1)

A build failure on HP-UX B.11.11 was introduced when O_cloexec was
changed to O_CLOEXEC (which is POSIX standard) in the backported
93v- code. The lowercase variant is conditionally defined by libast
in src/lib/libast/features/fcntl.c precisely for compatibility with
systems that do not have O_CLOEXEC.

src/lib/libast/tm/tvtouch.c:
- Revert to using the AST O_cloexec flag when calling open(2).
This commit is contained in:
Martijn Dekker 2021-01-23 00:40:00 +00:00
parent 6cc2f6a0af
commit e3f6d2d0e6

View file

@ -149,7 +149,7 @@ tvtouch(const char* path, register const Tv_t* av, register const Tv_t* mv, cons
return -1;
umask(mode = umask(0));
mode = (~mode) & (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
if ((fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, mode)) < 0)
if ((fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_cloexec, mode)) < 0)
return -1;
close(fd);
errno = oerrno;
@ -253,7 +253,7 @@ tvtouch(const char* path, register const Tv_t* av, register const Tv_t* mv, cons
errno = EINVAL;
return -1;
}
if ((fd = open(path, O_RDWR|O_CLOEXEC)) >= 0)
if ((fd = open(path, O_RDWR|O_cloexec)) >= 0)
{
char c;
@ -273,7 +273,7 @@ tvtouch(const char* path, register const Tv_t* av, register const Tv_t* mv, cons
return -1;
umask(mode = umask(0));
mode = (~mode) & (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
if ((fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, mode)) < 0)
if ((fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_cloexec, mode)) < 0)
return -1;
close(fd);
errno = oerrno;