Commit 038b9805 authored by bescoto's avatar bescoto

Added error checking when making special files


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@295 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 611cdb3c
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
"""Provides functions and *ITR classes, for writing increment files""" """Provides functions and *ITR classes, for writing increment files"""
import Globals, Time, rpath, Rdiff, log, statistics import Globals, Time, rpath, Rdiff, log, statistics, robust
def Increment(new, mirror, incpref): def Increment(new, mirror, incpref):
...@@ -59,9 +59,18 @@ def iscompressed(mirror): ...@@ -59,9 +59,18 @@ def iscompressed(mirror):
def makesnapshot(mirror, incpref): def makesnapshot(mirror, incpref):
"""Copy mirror to incfile, since new is quite different""" """Copy mirror to incfile, since new is quite different"""
compress = iscompressed(mirror) compress = iscompressed(mirror)
if compress: snapshotrp = get_inc(incpref, "snapshot.gz") if compress and mirror.isreg():
snapshotrp = get_inc(incpref, "snapshot.gz")
else: snapshotrp = get_inc(incpref, "snapshot") else: snapshotrp = get_inc(incpref, "snapshot")
rpath.copy_with_attribs(mirror, snapshotrp, compress)
if mirror.isspecial(): # check for errors when creating special increments
eh = robust.get_error_handler("SpecialFileError")
if robust.check_common_error(eh, rpath.copy_with_attribs,
(mirror, snapshotrp, compress)) == 0:
snapshotrp.setdata()
if snapshotrp.lstat(): snapshotrp.delete()
snapshotrp.touch()
else: rpath.copy_with_attribs(mirror, snapshotrp, compress)
return snapshotrp return snapshotrp
def makediff(new, mirror, incpref): def makediff(new, mirror, incpref):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment