Skip to content

Commit 8de60b4

Browse files
committed
---
yaml --- r: 37473 b: refs/heads/try c: a42d2d4 h: refs/heads/master i: 37471: be4ce0e v: v3
1 parent 4e07eee commit 8de60b4

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 09bb07bed9166105ea961a42b5fff7739ae0d2e9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
5-
refs/heads/try: 444a16a7e8a8d8d08c7804fda1bc6d0f1c44e3a3
5+
refs/heads/try: a42d2d408a74f677bb58a799f995d69f9fdd8438
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/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)