comparison dbutil.c @ 1336:efad433418c4

Use atomic key generation in all cases
author Matt Johnston <matt@ucc.asn.au>
date Sat, 19 Nov 2016 00:31:21 +0800
parents 3017bc7d6238
children 8747c2b19152
comparison
equal deleted inserted replaced
1335:253c08951b96 1336:efad433418c4
679 679
680 /* Fallback for everything else - this will sometimes go backwards */ 680 /* Fallback for everything else - this will sometimes go backwards */
681 return time(NULL); 681 return time(NULL);
682 } 682 }
683 683
684 684 void fsync_parent_dir(const char* fn) {
685 #ifdef HAVE_LIBGEN_H
686 char *fn_dir = m_strdup(fn);
687 char *dir = dirname(fn_dir);
688 int dirfd = open(dir, O_RDONLY);
689
690 if (dirfd != -1) {
691 if (fsync(dirfd) != 0) {
692 TRACE(("fsync of directory %s failed: %s", dir, strerror(errno)))
693 }
694 m_close(dirfd);
695 } else {
696 TRACE(("error opening directory %s for fsync: %s", dir, strerror(errno)))
697 }
698
699 free(fn_dir);
700 #endif
701 }