Skip to content

Commit f89a97d

Browse files
committed
---
yaml --- r: 40287 b: refs/heads/dist-snap c: a42d2d4 h: refs/heads/master i: 40285: 9f35663 40283: 7d5c419 40279: be03313 40271: 6a17365 40255: 61dd9ff v: v3
1 parent 320b95d commit f89a97d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
99
refs/heads/incoming: e90142e536c150df0d9b4b2f11352152177509b5
10-
refs/heads/dist-snap: 444a16a7e8a8d8d08c7804fda1bc6d0f1c44e3a3
10+
refs/heads/dist-snap: a42d2d408a74f677bb58a799f995d69f9fdd8438
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libcore/io.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,8 @@ impl<T: Writer, C> {base: T, cleanup: C}: Writer {
377377
impl *libc::FILE: Writer {
378378
fn write(v: &[const u8]) {
379379
do vec::as_const_buf(v) |vbuf, len| {
380-
let nout = libc::fwrite(vbuf as *c_void, len as size_t,
381-
1u as size_t, self);
382-
if nout < 1 as size_t {
380+
let nout = libc::fwrite(vbuf as *c_void, 1, len as size_t, self);
381+
if nout != len as size_t {
383382
error!("error writing buffer");
384383
log(error, os::last_os_error());
385384
fail;
@@ -959,6 +958,13 @@ mod tests {
959958
}
960959
}
961960

961+
#[test]
962+
fn test_write_empty() {
963+
let file = io::file_writer(&Path("tmp/lib-io-test-write-empty.tmp"),
964+
[io::Create]).get();
965+
file.write([]);
966+
}
967+
962968
#[test]
963969
fn file_writer_bad_name() {
964970
match io::file_writer(&Path("?/?"), ~[]) {

0 commit comments

Comments
 (0)