X-Git-Url: http://git.hcoop.net/bpt/guile.git/blobdiff_plain/f76cf73a49e0219f81a2fa0fc8431a0b83280822..b958141cdb081ceb16ca5828abda71f772fe0c57:/libguile/r6rs-ports.c diff --git a/libguile/r6rs-ports.c b/libguile/r6rs-ports.c index 3f936e71b..fc676895d 100644 --- a/libguile/r6rs-ports.c +++ b/libguile/r6rs-ports.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2009, 2010, 2011, 2013 Free Software Foundation, Inc. +/* Copyright (C) 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -216,10 +216,14 @@ cbp_seek (SCM port, scm_t_off offset, int whence) result = scm_call_0 (get_position_proc); else scm_wrong_type_arg_msg (FUNC_NAME, 0, port, - "R6RS custom binary port does not " - "support `port-position'"); - - offset += scm_to_int (result); + "R6RS custom binary port with " + "`port-position' support"); + c_result = scm_to_int (result); + if (offset == 0) + /* We just want to know the current position. */ + break; + + offset += c_result; /* Fall through. */ } @@ -232,8 +236,7 @@ cbp_seek (SCM port, scm_t_off offset, int whence) result = scm_call_1 (set_position_proc, scm_from_int (offset)); else scm_wrong_type_arg_msg (FUNC_NAME, 0, port, - "R6RS custom binary port does not " - "support `set-port-position!'"); + "seekable R6RS custom binary port"); /* Assuming setting the position succeeded. */ c_result = offset;