safely duplicate close
This commit is contained in:
parent
8ee41f4e1d
commit
b8710c17d8
|
|
@ -50,6 +50,7 @@ XDB_PUBLIC(int) xdb_new_with_buffer(xdb_searcher_t *xdb, const char *c_buffer) {
|
||||||
XDB_PUBLIC(void) xdb_close(xdb_searcher_t *xdb) {
|
XDB_PUBLIC(void) xdb_close(xdb_searcher_t *xdb) {
|
||||||
if (xdb->handle != NULL) {
|
if (xdb->handle != NULL) {
|
||||||
fclose(xdb->handle);
|
fclose(xdb->handle);
|
||||||
|
xdb->handle = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -339,4 +340,4 @@ XDB_PUBLIC(long) xdb_now() {
|
||||||
struct timeval c_time;
|
struct timeval c_time;
|
||||||
gettimeofday(&c_time, NULL);
|
gettimeofday(&c_time, NULL);
|
||||||
return c_time.tv_sec * (int)1e6 + c_time.tv_usec;
|
return c_time.tv_sec * (int)1e6 + c_time.tv_usec;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue