PVS-StudioWarnings

PVS-Studio warning V547 for PostgreSQL

Nov 20th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. typedef UINT_PTR SOCKET;
  2. typedef SOCKET pgsocket;
  3.  
  4. static int
  5. ident_inet(hbaPort *port)
  6. {
  7.   ....
  8.   pgsocket  sock_fd;
  9.   ....
  10.   sock_fd = socket(ident_serv->ai_family,
  11.                    ident_serv->ai_socktype,
  12.                    ident_serv->ai_protocol);
  13.   if (sock_fd < 0)
  14.   {
  15.   ....
  16. }
  17.  
  18. This suspicious code was found in PostgreSQL project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V547 Expression 'sock_fd < 0' is always false. Unsigned type value is never < 0. postgres auth.c 1668
  21.  
  22. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment