PVS-StudioWarnings

PVS-Studio warning V654 for KDE4

Nov 10th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. int PasswdProcess::ConversePasswd(....)
  2. {
  3.   ....
  4.   state = 0;
  5.   while (state != 1)
  6.   {
  7.     line = readLine();
  8.     if (line.isNull())
  9.     {
  10.       // No more input... OK
  11.       return 0;
  12.     }
  13.     if (isPrompt(line, "password"))
  14.     {
  15.       // Uh oh, another prompt. Not good!
  16.       kill(m_Pid, SIGKILL);
  17.       waitForChild();
  18.       return PasswordNotGood;
  19.     }
  20.     m_Error += line + '\n'; // Collect error message
  21.   }
  22.   ....
  23. }
  24.  
  25. This suspicious code was found in KDE4 project by PVS-Studio static code analyzer.
  26. Warning message is:
  27. V654 The condition 'state != 1' of loop is always true. passwd.cpp 255
  28.  
  29. 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