From: Zooko O'Whielacronx zooko@zooko.com Date: Sat, 21 Apr 2007 14:48:47 +0000 (+0530) Subject: zfec: fix another problem with the O_BINARY flag X-Git-Url: https://git.rkrishnan.org/uri/frontends/FTP-and-SFTP.rst?a=commitdiff_plain;h=39fe7ef3cb804b2ff155b236e6fd6afa03ccc3d1;p=tahoe-lafs%2Fzfec.git zfec: fix another problem with the O_BINARY flag darcs-hash:dfda0b71c2692316248fd38e97355c872f7badcb --- diff --git a/zfec/zfec/filefec.py b/zfec/zfec/filefec.py index efacd12..5590850 100644 --- a/zfec/zfec/filefec.py +++ b/zfec/zfec/filefec.py @@ -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)