Fix collecdmon not start collectd
[collectd.git] / src / collectdmon.c
index 59bebf0..36cd939 100644 (file)
@@ -259,7 +259,7 @@ static void check_respawn(void) {
                     "disabled for %i seconds",
            time_left);
 
-    while (((time_left = sleep(time_left)) >= 0) && loop == 0)
+    while (((time_left = sleep(time_left)) > 0) && loop == 0)
       ;
   }
   return;
@@ -276,9 +276,10 @@ int main(int argc, char **argv) {
   while (42) {
     int c = getopt(argc, argv, "hc:P:");
 
-    switch (c) {
-    case -1:
+    if (c == -1)
       break;
+
+    switch (c) {
     case 'c':
       collectd = optarg;
       break;