]> git.rkrishnan.org Git - tahoe-lafs/zfec.git/commitdiff
zfec: fix another problem with the O_BINARY flag
authorZooko O'Whielacronx zooko@zooko.com <zooko@zooko.com>
Sat, 21 Apr 2007 14:48:47 +0000 (20:18 +0530)
committerZooko O'Whielacronx zooko@zooko.com <zooko@zooko.com>
Sat, 21 Apr 2007 14:48:47 +0000 (20:18 +0530)
darcs-hash:dfda0b71c2692316248fd38e97355c872f7badcb

zfec/zfec/filefec.py

index efacd12e801db72223c5df6b280355d989b481cd..55908504126b29810a7492aefff5b7a4978ce973 100644 (file)
@@ -174,7 +174,8 @@ def encode_to_files(inf, fsize, dirname, prefix, k, m, suffix=".fec", overwrite=
             if overwrite:
                 f = open(fn, "wb")
             else:
-                fd = os.open(fn, os.O_WRONLY|os.O_CREAT|os.O_EXCL|os.O_BINARY)
+                flags = os.O_WRONLY|os.O_CREAT|os.O_EXCL | (hasattr(os, 'O_BINARY') and os.O_BINARY)
+                fd = os.open(fn, flags)
                 f = os.fdopen(fd, "wb")
             f.write(hdr)
             fs.append(f)