Skip to content

Commit 229a672

Browse files
author
Commitfest Bot
committed
[CF 5882] GNU/Hurd portability patches
This branch was automatically generated by a robot using patches from an email thread registered at: https://commitfest.postgresql.org/patch/5882 The branch will be overwritten each time a new patch version is posted to the thread, and also periodically to check for bitrot caused by changes on the master branch. Patch(es): https://www.postgresql.org/message-id/[email protected] Author(s): Michael Banck
2 parents f20a347 + f776458 commit 229a672

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/backend/storage/file/fd.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -411,14 +411,12 @@ pg_fsync(int fd)
411411
{
412412
int desc_flags = fcntl(fd, F_GETFL);
413413

414-
/*
415-
* O_RDONLY is historically 0, so just make sure that for directories
416-
* no write flags are used.
417-
*/
414+
desc_flags &= O_ACCMODE;
415+
418416
if (S_ISDIR(st.st_mode))
419-
Assert((desc_flags & (O_RDWR | O_WRONLY)) == 0);
417+
Assert(desc_flags == O_RDONLY);
420418
else
421-
Assert((desc_flags & (O_RDWR | O_WRONLY)) != 0);
419+
Assert(desc_flags != O_RDONLY);
422420
}
423421
errno = 0;
424422
#endif

src/include/port/pg_iovec.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121

2222
#else
2323

24-
/* POSIX requires at least 16 as a maximum iovcnt. */
25-
#define IOV_MAX 16
26-
2724
/* Define our own POSIX-compatible iovec struct. */
2825
struct iovec
2926
{
@@ -33,6 +30,11 @@ struct iovec
3330

3431
#endif
3532

33+
/* POSIX requires at least 16 as a maximum iovcnt. */
34+
#ifndef IOV_MAX
35+
#define IOV_MAX 16
36+
#endif
37+
3638
/*
3739
* Define a reasonable maximum that is safe to use on the stack in arrays of
3840
* struct iovec and other small types. The operating system could limit us to

0 commit comments

Comments
 (0)