maint: fix build error on AIX

Collin Funk <[email protected]> Sun, 25 May 2025 15:39:02 -0700
Newsgroups gmane.comp.version-control.rcs.bugs
Message-ID <[email protected]>
--=-=-=
Content-Type: text/plain

Hi Paul,

On AIX, rcs fails to build with the following error:

      CC       rcsfnms.o
    rcsfnms.c: In function 'finopen':
    rcsfnms.c:195:19: error: 'struct maybe' has no member named 'rpl_open'
      195 |   FLOW (from) = (m->open) (m);
          |                   ^~
    In file included from ../lib/unistd.h:117,
                     from ../lib/stdlib.h:121,
                     from rcsfnms.c:27:
    rcsfnms.c: In function 'pairnames':
    rcsfnms.c:273:8: error: 'struct maybe' has no member named 'rpl_open'
      273 |       .open = rcsopen,
          |        ^~~~
    make[2]: *** [Makefile:2405: rcsfnms.o] Error 1
    make[2]: Leaving directory '/home/collinfunk/rcs-5.10.1.33-361d/src'

I have attached a simple 1 line patch to fix this. We can just include
<fcntl.h> so 'open' expands to the same thing everywhere, including the
'struct maybe' definition.

Collin


--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: attachment;
 filename=0001-maint-Fix-build-error-on-AIX.patch
Content-Transfer-Encoding: quoted-printable

From 62ee5fc06ade8dce40bdbf28fa3a85fe89cdc91b Mon Sep 17 00:00:00 2001
Message-ID: <62ee5fc06ade8dce40bdbf28fa3a85fe89cdc91b.1748212695.git.collin=
[email protected]>
From: Collin Funk <[email protected]>
Date: Sun, 25 May 2025 15:29:29 -0700
Subject: [PATCH] maint: Fix build error on AIX

* src/base.h: Include fcntl.h at the top of the file in case
'open' gets defined to 'rpl_open'.
---
 ChangeLog  | 6 ++++++
 src/base.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index affa637..bd8cab7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-05-25  Collin Funk  <[email protected]>
+
+	[maint] Fix build error on AIX
+	* src/base.h: Include fcntl.h at the top of the file in case
+	'open' gets defined to 'rpl_open'.
+
 2024-09-26  Paul Eggert  <[email protected]>
=20
 	[maint] Don=E2=80=99t assume MMAP_SIGNAL !=3D SIGBUS
diff --git a/src/base.h b/src/base.h
index d9b2ee4..0fc6e93 100644
--- a/src/base.h
+++ b/src/base.h
@@ -22,6 +22,7 @@
 */
=20
 #include "config.h"
+#include <fcntl.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
--=20
2.49.0


--=-=-=--