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 652602 - unbreak compilation if NI_IDN is not defined
unbreak compilation if NI_IDN is not defined
Status: RESOLVED FIXED
Product: system-monitor
Classification: Core
Component: general
git master
Other OpenBSD
: Normal major
: ---
Assigned To: System-monitor maintainers
System-monitor maintainers
: 583923 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-06-14 21:55 UTC by Antoine Jacoutot
Modified: 2012-01-07 18:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
define NI_IDN to 0 if it's not already defined (570 bytes, patch)
2011-06-14 21:55 UTC, Antoine Jacoutot
committed Details | Review

Description Antoine Jacoutot 2011-06-14 21:55:26 UTC
Created attachment 189946 [details] [review]
define NI_IDN to 0 if it's not already defined

Hi.

Under (at least) OpenBSD, NI_IDN is not defined and the compilation fails with:
openfiles.cpp: In function 'char* friendlier_hostname(const char*, int)':
openfiles.cpp:74: error: 'NI_IDN' was not declared in this scope

The following patch fixes it by defined NI_IDN to 0 if not already defined.

Thoughts?
Comment 1 Chris Kühl 2011-06-15 08:16:06 UTC
Committed. Thanks.
Comment 2 Robert Roth 2012-01-06 23:52:19 UTC
*** Bug 583923 has been marked as a duplicate of this bug. ***
Comment 3 Daniel Macks 2012-01-07 18:03:50 UTC
Please see my comments several years ago in Bug #583923 with concerns about the hard-coding solution? I stand by my main "how is hardcoding the value of a system-function token a safe-sounding idea" concern. NI_IDN affects the return-value of getnameinfo(), so if you're no longer sure whether that's happening (because you obscure whether that feature is present), downstream consumers of the return value have a bit of chaos. The effect of this solution is probably safe in this context, albeit confusing as hell to those of us who have to port this code to non-linux platforms. For example, the implemented solution is:

#ifndef NI_IDN
#define NI_IDN 0
#endif
getaddrinfo(..., NI_IDN);

A more self-documenting and less surprising ("Why does this not bomb? I know I don't have this glibc extension on my platform!" and leaving it obvious where others could help extend missing functionality) way would be:

#ifdef NI_IDN
getaddrinfo(..., NI_IDN);
#else
getaddrinfo(...);
#endif

And I stand by my "why is s-m apparently duplicating functionality available in other libraries" question about this code segment.