From: Zooko O'Whielacronx Date: Sat, 21 Apr 2007 14:48:47 +0000 (-0700) Subject: zfec: fix another problem with the O_BINARY flag X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~3 X-Git-Url: https://git.rkrishnan.org/rgr-080307.php?a=commitdiff_plain;h=032993e7f21144c3eef82f4f26f481c40631e44a;p=tahoe-lafs%2Ftahoe-lafs.git zfec: fix another problem with the O_BINARY flag --- diff --git a/src/zfec/zfec/filefec.py b/src/zfec/zfec/filefec.py index efacd12e..55908504 100644 --- a/src/zfec/zfec/filefec.py +++ b/src/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)