Close the db
This commit is contained in:
parent
24b3c2bc46
commit
570d09aba7
2 changed files with 9 additions and 2 deletions
10
phoned/db.c
10
phoned/db.c
|
@ -27,7 +27,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
/* $Amigan: phoned/phoned/db.c,v 1.2 2005/06/18 21:47:16 dcp1990 Exp $ */
|
/* $Amigan: phoned/phoned/db.c,v 1.3 2005/06/19 00:10:51 dcp1990 Exp $ */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -131,4 +131,10 @@ short db_init(dbfilename)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
short db_destroy(void)
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&dbmx);
|
||||||
|
sqlite3_close(db);
|
||||||
|
pthread_mutex_unlock(&dbmx);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ void shutd(whatdone)
|
||||||
pthread_mutex_lock(&logfmx);
|
pthread_mutex_lock(&logfmx);
|
||||||
if(whatdone & WD_LOGS) fclose(logf);
|
if(whatdone & WD_LOGS) fclose(logf);
|
||||||
pthread_mutex_unlock(&logfmx);
|
pthread_mutex_unlock(&logfmx);
|
||||||
|
if(whatdone & WD_DBINIT) db_destroy();
|
||||||
unlink(SOCKETFILE);
|
unlink(SOCKETFILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue