This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]