changeset 51657:e10b8388f27b stable

portability: fix build on Solaris-derived systemd Current Illumos and older Solaris require _XOPEN_SOURCE for msg_control. O_DIRECTORY doesn't exist on older systems either, so fallback to O_RDONLY. It's good enough as a repository will require both R and X permission anyway.
author Joerg Sonnenberger <joerg@bec.de>
date Mon, 24 Jun 2024 18:54:59 +0200
parents 21442f87f7fa
children c3a622e5c6f2
files contrib/chg/hgclient.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/chg/hgclient.c	Wed Jul 03 12:32:57 2024 +0200
+++ b/contrib/chg/hgclient.c	Mon Jun 24 18:54:59 2024 +0200
@@ -7,6 +7,11 @@
  * GNU General Public License version 2 or any later version.
  */
 
+#if defined(__sun) && !defined(_XOPEN_SOURCE)
+/* msg_control is used */
+#define _XOPEN_SOURCE 600
+#endif
+
 #include <arpa/inet.h> /* for ntohl(), htonl() */
 #include <assert.h>
 #include <ctype.h>
@@ -26,6 +31,10 @@
 #include "procutil.h"
 #include "util.h"
 
+#ifndef O_DIRECTORY
+#define O_DIRECTORY O_RDONLY
+#endif
+
 enum {
 	CAP_GETENCODING = 0x0001,
 	CAP_RUNCOMMAND = 0x0002,