From 1495674884a5567d61699fbcd5b73ce10cff59fd Mon Sep 17 00:00:00 2001 From: Daniel Hedlund Date: Mon, 16 Dec 2013 10:43:40 -0800 Subject: [PATCH] Truncate output files created in store_png Use io::Truncate instead of io::Open for file mode. --- lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib.rs b/lib.rs index 42105b4..d59f80a 100644 --- a/lib.rs +++ b/lib.rs @@ -187,7 +187,7 @@ pub extern fn flush_data(png_ptr: *ffi::png_struct) { #[fixed_stack_segment] pub fn store_png(img: &Image, path: &Path) -> Result<(),~str> { - let mut file = match File::open_mode(path, io::Open, io::Write) { + let mut file = match File::open_mode(path, io::Truncate, io::Write) { Some(file) => file, None => return Err(~"could not open file") };