Permalink
Browse files

bugfix: properly fail failing writes in ddfs_put.

  • Loading branch information...
pmundkur committed Mar 15, 2012
1 parent 4f20b8a commit 8944b59f2060fca73c7d9c2ecaab047a33b42428
Showing with 4 additions and 2 deletions.
  1. +4 −2 master/src/ddfs/ddfs_put.erl
@@ -106,8 +106,10 @@ receive_blob(Req, IO, Dst, Url) ->
receive_body(Req, IO) ->
R0 = Req:stream_body(?MAX_RECV_BODY,
fun ({BufLen, Buf}, BodyLen) ->
- file:write(IO, Buf),
- BodyLen + BufLen
+ case file:write(IO, Buf) of
+ ok -> BodyLen + BufLen;
+ {error, E} -> throw(E) % caught in receive_blob/4.
+ end
end, 0),
case R0 of
% R == <<>> or undefined if body is empty

0 comments on commit 8944b59

Please sign in to comment.