From 032993e7f21144c3eef82f4f26f481c40631e44a Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Sat, 21 Apr 2007 07:48:47 -0700 Subject: [PATCH] zfec: fix another problem with the O_BINARY flag --- src/zfec/zfec/filefec.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- 2.45.2