From: Teemu Toivola Date: Wed, 8 May 2019 20:19:59 +0000 (+0300) Subject: remove strerror(errno) information from secondary error prints when opening the datab... X-Git-Tag: v2.3~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73ded75310166864123651a30fcc5b4961fe8162;p=vnstat remove strerror(errno) information from secondary error prints when opening the database has failed, that information can be misleading when the error is sqlite related in which case the earlier error print has anyway the correct information --- diff --git a/src/vnstat.c b/src/vnstat.c index 8503eaa..c8571ae 100644 --- a/src/vnstat.c +++ b/src/vnstat.c @@ -406,7 +406,7 @@ int main(int argc, char *argv[]) closedir(dir); strncpy_nt(cfg.dbdir, p.dirname, 512); if (!db_open_ro()) { - printf("Error: Unable to open database \"%s/%s\": %s\n", p.dirname, DATABASEFILE, strerror(errno)); + printf("Error: Failed to open database \"%s/%s\" in read-only mode.\n", p.dirname, DATABASEFILE); if (errno == ENOENT) { printf("The vnStat daemon should have created the database when started.\n"); printf("Check that it is configured and running. See also \"man vnstatd\".\n"); diff --git a/src/vnstatd.c b/src/vnstatd.c index f23fd73..f7a0dcc 100644 --- a/src/vnstatd.c +++ b/src/vnstatd.c @@ -158,7 +158,7 @@ int main(int argc, char *argv[]) setuser(s.user); if (!db_open_rw(1)) { - printf("Error: Unable to open database \"%s/%s\": %s\n", s.dirname, DATABASEFILE, strerror(errno)); + printf("Error: Failed to open database \"%s/%s\" in read/write mode.\n", s.dirname, DATABASEFILE); printf("Exiting...\n"); exit(EXIT_FAILURE); } diff --git a/src/vnstati.c b/src/vnstati.c index 4d73352..fe8335f 100644 --- a/src/vnstati.c +++ b/src/vnstati.c @@ -411,7 +411,7 @@ void handlecaching(IPARAMS *p, IMAGECONTENT *ic) void handledatabase(IPARAMS *p, IMAGECONTENT *ic) { if (!db_open_ro()) { - printf("Error: Unable to open database \"%s/%s\": %s\n", cfg.dbdir, DATABASEFILE, strerror(errno)); + printf("Error: Failed to open database \"%s/%s\" in read-only mode.\n", cfg.dbdir, DATABASEFILE); exit(EXIT_FAILURE); } if (!db_getinterfacecountbyname(p->interface)) {