]> granicus.if.org Git - vnstat/commitdiff
make filename reservation for possible future feature
authorTeemu Toivola <git@humdi.net>
Fri, 29 Aug 2014 19:57:43 +0000 (22:57 +0300)
committerTeemu Toivola <git@humdi.net>
Fri, 29 Aug 2014 19:57:43 +0000 (22:57 +0300)
src/common.h
src/daemon.c
src/vnstat.c

index d2a03771211d89bf96a4e10af4fd73ef2cfbdb16..53f611be558c8ee7209bea3f6fb864d1e1bc7f3d 100644 (file)
@@ -55,6 +55,7 @@ and most can be changed later from the config file.
 #define DATABASEDIR "/var/lib/vnstat"
 #endif
 #endif
+#define DATABASEFILE "vnstat.db"
 
 /* on which day should months change */
 #define MONTHROTATE 1
index 46095ce6f470310c9bf033f65a3d1bf7666743dd..d117acd98dadfb334a7d50cd612de6a023b05bfc 100644 (file)
@@ -421,7 +421,7 @@ void preparedatabases(DSTATE *s)
        /* check if there's something to work with */
        s->dbcount = 0;
        while ((di=readdir(dir))) {
-               if (di->d_name[0]!='.') {
+               if ((di->d_name[0]!='.') && (strcmp(di->d_name, DATABASEFILE)!=0)) {
                        s->dbcount++;
                }
        }
@@ -486,7 +486,7 @@ void filldatabaselist(DSTATE *s)
        }
 
        while ((di=readdir(dir))) {
-               if (di->d_name[0]=='.') {
+               if ((di->d_name[0]=='.') || (strcmp(di->d_name, DATABASEFILE)==0)) {
                        continue;
                }
 
index 25b3ac0a4209dab3c9e79fb355f1df914b54491a..66e6f1ac199350db5b213f5997b709e968962088 100644 (file)
@@ -301,7 +301,7 @@ int main(int argc, char *argv[]) {
                        if (debug)
                                printf("Dir OK\n");
                        while ((di=readdir(dir))) {
-                               if (di->d_name[0]=='.') {
+                               if ((di->d_name[0]=='.') || (strcmp(di->d_name, DATABASEFILE)==0)) {
                                        continue;
                                }
                                strncpy_nt(p.definterface, di->d_name, 32);
@@ -744,7 +744,7 @@ void handleupdate(PARAMS *p)
                while ((di=readdir(dir))) {
 
                        /* ignore backup files, '.' and '..' dirs */
-                       if (di->d_name[0]=='.') {
+                       if ((di->d_name[0]=='.') || (strcmp(di->d_name, DATABASEFILE)==0)) {
                                continue;
                        }
 
@@ -862,7 +862,7 @@ void handleshowdatabases(PARAMS *p)
                                return;
                        }
                        while ((di=readdir(dir))) {
-                               if (di->d_name[0]=='.') {
+                               if ((di->d_name[0]=='.') || (strcmp(di->d_name, DATABASEFILE)==0)) {
                                        continue;
                                }
                                strncpy_nt(p->interface, di->d_name, 32);