def fsync_dir(dirpath):
 dirfd = None
 try:
  dirfd = os.open(dirpath, (os.O_DIRECTORY | os.O_RDONLY))
  fsync(dirfd)
 except OSError as err:
  if (err.errno == errno.ENOTDIR):
   raise
  logging.warning(_('Unable to perform fsync() on directory %(dir)s: %(err)s'), {'dir': dirpath, 'err': os.strerror(err.errno)})
 finally:
  if dirfd:
   os.close(dirfd)

def fsync_dir ( dirpath ) : dirfd = None try : dirfd = os . open ( dirpath , ( os . O_DIRECTORY | os . O_RDONLY ) ) fsync ( dirfd ) except OSError as err : if ( err . errno == errno . ENOTDIR ) : raise logging . warning ( _ ( 'Unable to perform fsync() on directory %(dir)s: %(err)s' ) , { 'dir' : dirpath , 'err' : os . strerror ( err . errno ) } ) finally : if dirfd : os . close ( dirfd )
sync directory entries to disk .