From 39fe7ef3cb804b2ff155b236e6fd6afa03ccc3d1 Mon Sep 17 00:00:00 2001 From: "Zooko O'Whielacronx zooko@zooko.com" Date: Sat, 21 Apr 2007 20:18:47 +0530 Subject: [PATCH] zfec: fix another problem with the O_BINARY flag darcs-hash:dfda0b71c2692316248fd38e97355c872f7badcb --- zfec/zfec/filefec.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- 2.45.2