From: Fredrik Tolf Date: Fri, 17 Jun 2011 10:11:55 +0000 (+0200) Subject: Make sure database and environment are properly closed by statdbput. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=e9b9b1bc0c0dad06b9a9c646adfecdf13247a7c1;p=statserve.git Make sure database and environment are properly closed by statdbput. --- diff --git a/statdbput.c b/statdbput.c index 569afe1..061d5ee 100644 --- a/statdbput.c +++ b/statdbput.c @@ -212,6 +212,8 @@ int main(int argc, char **argv) while(1) { if((ret = env->txn_begin(env, NULL, &txn, 0)) != 0) { fprintf(stderr, "statdbput: could not begin transaction in %s: %s\n", dbpath, db_strerror(ret)); + db->close(db, 0); + env->close(env, 0); return(1); } rv = 0; @@ -255,8 +257,12 @@ int main(int argc, char **argv) } if((ret = txn->commit(txn, 0)) != 0) { fprintf(stderr, "statdbput: could not commit transaction in %s: %s\n", dbpath, db_strerror(ret)); + db->close(db, 0); + env->close(env, 0); return(1); } + db->close(db, 0); + env->close(env, 0); if(ul) { for(i = 0; i < files.d; i++) { if(verbose)