Coverity: Fix TAINTED_SCALAR warning
This commit is contained in:
+19
-3
@@ -112,11 +112,22 @@ main(int argc, char **argv)
|
||||
log_start_from_param(lc);
|
||||
}
|
||||
|
||||
if (argc > 1 && atoi(argv[1]) > 0)
|
||||
if (argc > 1 && atoi(argv[1]) >= 0)
|
||||
{
|
||||
changes = atoi(argv[1]);
|
||||
if (changes > 1000)
|
||||
{
|
||||
changes = 1000; // Use 0 for more than this
|
||||
}
|
||||
}
|
||||
if (changes > 0)
|
||||
{
|
||||
printf("Connection monitor : exiting after %d state changes\n", changes);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Connection monitor\n");
|
||||
}
|
||||
printf("Connection monitor : exiting after %d state changes\n", changes);
|
||||
|
||||
print_current_connection_state();
|
||||
|
||||
@@ -128,7 +139,7 @@ main(int argc, char **argv)
|
||||
else
|
||||
{
|
||||
int count = 0;
|
||||
while (count < changes && result == 0)
|
||||
while (result == 0)
|
||||
{
|
||||
struct pollfd pollarg =
|
||||
{
|
||||
@@ -139,6 +150,11 @@ main(int argc, char **argv)
|
||||
int pollstat;
|
||||
LRESULT cbresult;
|
||||
|
||||
if (changes > 0 && count >= changes)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if ((pollstat = poll(&pollarg, 1, -1)) < 0)
|
||||
{
|
||||
printf("** Error from poll() : %s\n", strerror(errno));
|
||||
|
||||
Reference in New Issue
Block a user