GNOME Bugzilla – Bug 750536
Patch required for app/load_save.c to compile on NetBSD and OpenBSD
Last modified: 2019-03-20 12:05:36 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
(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...)
-- 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.