Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/olpc/datastore/backingstore.py
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2007-11-10 15:09:05 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2007-11-10 15:09:05 (GMT)
commit8487ee1e1f4e18b35cdcbad4f866dacd2df8f35a (patch)
tree3bad4fc90461e4b7f24344430a7b1c9d4e684c3e /src/olpc/datastore/backingstore.py
parenta9f31e4cc8cf1a9b7fcae2317a4d3b337fae19c5 (diff)
#4796 Ignore failure to chmod files in usb sticks.
Diffstat (limited to 'src/olpc/datastore/backingstore.py')
-rw-r--r--src/olpc/datastore/backingstore.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/olpc/datastore/backingstore.py b/src/olpc/datastore/backingstore.py
index 4445e40..c9ef05a 100644
--- a/src/olpc/datastore/backingstore.py
+++ b/src/olpc/datastore/backingstore.py
@@ -395,7 +395,16 @@ class FileBackingStore(BackingStore):
targetpath = "%s(%s)%s" % (targetpath, attempt, ext)
- os.chmod(path, 0604)
+ # Try to make the original file readable. This can fail if the file is
+ # in FAT filesystem.
+ try:
+ os.chmod(path, 0604)
+ except OSError, e:
+ if e.errno != errno.EPERM:
+ raise
+
+ # Try to link from the original file to the targetpath. This can work if
+ # the file is in a different filesystem. Do a copy instead.
try:
os.link(path, targetpath)
except OSError, e: