소스 검색

Improve log message when fsync'ing directory fails (fixes 656)

Unrud 8 년 전
부모
커밋
d3a90d16c3
1개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 8 4
      radicale/storage.py

+ 8 - 4
radicale/storage.py

@@ -688,11 +688,15 @@ class Collection(BaseCollection):
         if not cls.configuration.getboolean("storage", "filesystem_fsync"):
             return
         if os.name == "posix":
-            fd = os.open(path, 0)
             try:
-                cls._fsync(fd)
-            finally:
-                os.close(fd)
+                fd = os.open(path, 0)
+                try:
+                    cls._fsync(fd)
+                finally:
+                    os.close(fd)
+            except OSError as e:
+                raise RuntimeError("Fsync'ing directory %r failed: %s" %
+                                   (path, e)) from e
 
     @classmethod
     def _makedirs_synced(cls, filesystem_path):