After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 750536 - Patch required for app/load_save.c to compile on NetBSD and OpenBSD
Patch required for app/load_save.c to compile on NetBSD and OpenBSD
Status: RESOLVED OBSOLETE
Product: dia
Classification: Other
Component: general
0.97.x
Other NetBSD
: Normal normal
: ---
Assigned To: Dia maintainers
Dia maintainers
Depends on:
Blocks:
 
 
Reported: 2015-06-07 23:30 UTC by David H. Gutteridge
Modified: 2019-03-20 12:05 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description David H. Gutteridge 2015-06-07 23:30:03 UTC
fchmod() can't be portably exposed with one particular macro, it's
hidden using various macro names depending upon the OS in question.
I've just updated packaging of Dia for pkgsrc.org for NetBSD and
OpenBSD, my patch is below.

pkgsrc covers a lot of OSes. I've limited my concern to the BSDs. But
I'm not even sure the existing code is portable to all Linux distros,
e.g. Fedora appears to require __USE_POSIX to expose fchmod(). It
looks like DragonFly BSD will work by default (though I haven't
tested it), and OpenSolaris-derived OSes will work because of
_POSIX_C_SOURCE being used (at least, according to looking at the
Illumos sources, again, I haven't tested it). My two cents.

--- app/load_save.c.orig    2014-08-24 11:46:01.000000000 -0400
+++ app/load_save.c
@@ -19,7 +19,14 @@

 /* so we get fdopen declared even when compiling with -ansi */
 #define _POSIX_C_SOURCE 200809L
-#define _BSD_SOURCE 1 /* to get the prototype for fchmod() */
+/* to get the prototype for fchmod() */
+#if defined(__NetBSD__)
+#define _NETBSD_SOURCE 1
+#elif defined(__OpenBSD__)
+#define __BSD_VISIBLE 1
+#else
+#define _BSD_SOURCE 1
+#endif

 #include <sys/stat.h>
 #ifdef HAVE_UNISTD_H
Comment 1 David H. Gutteridge 2015-06-08 00:47:14 UTC
(Bah, ignore my comment about Fedora, _POSIX_C_SOURCE >= 1 exposes __USE_POSIX in features.h. It's been a while since I've had to look at this stuff...)
Comment 2 GNOME Infrastructure Team 2019-03-20 12:05:36 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/dia/issues/356.