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 nptl/16876] New: nptl/sockperf.c:105: possible bad if test ?


https://sourceware.org/bugzilla/show_bug.cgi?id=16876

            Bug ID: 16876
           Summary: nptl/sockperf.c:105: possible bad if test ?
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
          Assignee: unassigned at sourceware dot org
          Reporter: dcb314 at hotmail dot com
                CC: drepper.fsp at gmail dot com

Static analyser cppcheck says

[trunk/nptl/sockperf.c:105]: (style) A pointer can not be negative so it is
either pointless or an error to check if it is.

Source code is

      servpoll[cnt].fd = socket (AF_UNIX, SOCK_STREAM, 0);
      if (clisock < 0)

but

  int clisock[nserv];

Maybe better code might be

      servpoll[cnt].fd = socket (AF_UNIX, SOCK_STREAM, 0);
      if (servpoll[cnt].fd < 0)

-- 
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]