comparison dbutil.c @ 1329:185c14fa504d

Use atomic key generation in all cases
author Matt Johnston <matt@ucc.asn.au>
date Sat, 19 Nov 2016 00:31:21 +0800
parents 21156be2bb26
children bbc0a0ee3843
comparison
equal deleted inserted replaced
1328:c13aa2cd8d51 1329:185c14fa504d
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 }