]> granicus.if.org Git - vnstat/commitdiff
fix database search when resuming daemon operations, modify info print to fit 80...
authorTeemu Toivola <git@humdi.net>
Tue, 1 Jul 2014 20:45:58 +0000 (23:45 +0300)
committerTeemu Toivola <git@humdi.net>
Tue, 1 Jul 2014 20:45:58 +0000 (23:45 +0300)
src/daemon.c
src/vnstatd.c

index 2b818286893775efd20c92f6c9372bf635ef8e6b..300e0e46d4adddf5b899176065c03199ff7a7fd1 100644 (file)
@@ -167,7 +167,7 @@ int addinterfaces(const char *dirname)
        }
 
        if (count) {
-               printf(" Limits can be modified using the configuration file. See \"man vnstat.conf\".");
+               printf("\nLimits can be modified using the configuration file. See \"man vnstat.conf\".");
        }
 
        printf("\n");
index eaedee7442673a755620814c3712dbe2cd0dd607..7d8fe3f8a2ecfef77fdcbb5110c5ddcaf25fe910 100644 (file)
@@ -264,23 +264,28 @@ void preparedatabases(DSTATE *s)
                }
        }
        closedir(dir);
-       if (s->dbcount==0) {
-               if (s->noadd) {
-                       printf("Zero database found, exiting.\n");
-                       exit(EXIT_FAILURE);
-               }
-               if (!spacecheck(s->dirname)) {
-                       printf("Error: Not enough free diskspace available, exiting.\n");
-                       exit(EXIT_FAILURE);
-               }
-               printf("Zero database found, adding available interfaces...\n");
-               if (!addinterfaces(s->dirname)) {
-                       printf("Nothing to do, exiting.\n");
-                       exit(EXIT_FAILURE);
-               }
-               /* set counter back to zero so that dbs will be cached later */
+
+       if (s->dbcount > 0) {
                s->dbcount = 0;
+               return;
+       }
+
+       if (s->noadd) {
+               printf("Zero database found, exiting.\n");
+               exit(EXIT_FAILURE);
+       }
+       if (!spacecheck(s->dirname)) {
+               printf("Error: Not enough free diskspace available, exiting.\n");
+               exit(EXIT_FAILURE);
        }
+       printf("Zero database found, adding available interfaces...\n");
+       if (!addinterfaces(s->dirname)) {
+               printf("Nothing to do, exiting.\n");
+               exit(EXIT_FAILURE);
+       }
+
+       /* set counter back to zero so that dbs will be cached later */
+       s->dbcount = 0;
 }
 
 void setsignaltraps(void)