Wrong _XOPEN_SOURCE level to get strdup on OS X...

Bug #1638205 reported by John Szakmeister
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libvterm
Fix Released
Undecided
Unassigned

Bug Description

The file vterm-ctrl.c should be defining _XOPEN_SOURCE to 600 in order to gain access to strdup on OS X. Since it's currently 500, the function is not exposed correctly, and the compiler gets the arguments and return type wrong.

Revision history for this message
John Szakmeister (jszakmeister) wrote :

FWIW, I reported this bug to Apple several years ago. :-( What you're doing is correct, but OS X has strdup() shown as requiring SuSv3 or better, rather than v2 or better.

Revision history for this message
Paul "LeoNerd" Evans (leonerd) wrote :

I wonder - is there a #define I can reliably use to detect this Apple situation? I could then do something like

#ifdef __APPLE__
// Apple requires 600 to get strdup()
# define _XOPEN_SOURCE 600
#else
# define _XOPEN_SOURCE 500
#endif

Revision history for this message
John Szakmeister (jszakmeister) wrote :

Yes, you can use exactly that.

Revision history for this message
Paul "LeoNerd" Evans (leonerd) wrote :

I've just set it to 600 unconditionally; that seems to solve matters.

Changed in libvterm:
status: New → Fix Committed
Changed in libvterm:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.