[Bug libc/12717] New: declaration of getnameinfo() is not POSIX compliant

bruno at clisp dot org sourceware-bugzilla@sourceware.org
Sat Apr 30 10:37:00 GMT 2011


http://sourceware.org/bugzilla/show_bug.cgi?id=12717

           Summary: declaration of getnameinfo() is not POSIX compliant
           Product: glibc
           Version: 2.13
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: bruno@clisp.org


POSIX:2008 specifies the declaration of getnameinfo() in
http://pubs.opengroup.org/onlinepubs/9699919799/functions/getnameinfo.html
In particular, the last parameter should be an 'int'.

In glibc's <netdb.h>, the parameter is an 'unsigned int'. This leads to
a compilation error for POSIX compliant programs.

How to reproduce:
============================== foo.cc ==============================
#include <netdb.h>
int (*getnameinfo_ptr) (const struct sockaddr *sa, socklen_t salen,
                        char *node, socklen_t nodelen,
                        char *service, socklen_t servicelen,
                        int flags) = getnameinfo;
====================================================================
$ g++ -c foo.cc 
foo.cc:5: error: invalid conversion from ‘int (*)(const sockaddr*, socklen_t,
char*, socklen_t, char*, socklen_t, unsigned int)’ to ‘int (*)(const sockaddr*,
socklen_t, char*, socklen_t, char*, socklen_t, int)’

Attached is a probable fix (untested).

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the Glibc-bugs mailing list