From: Nick Bowler Date: Thu, 4 Feb 2010 16:47:18 +0000 (-0500) Subject: liblbx: Don't ignore whence parameter in pipe_seek. X-Git-Url: https://git.draconx.ca/gitweb/liblbx.git/commitdiff_plain/958926fd7382d2c44828cdc70ca6c27bb281ff0d liblbx: Don't ignore whence parameter in pipe_seek. The code from which this derived only supported SEEK_SET-like operations, so SEEK_CUR was forgotten when converting it. SEEK_END obviously cannot be supported on pipes. --- diff --git a/src/fops.c b/src/fops.c index 2ae6c61..834c8b2 100644 --- a/src/fops.c +++ b/src/fops.c @@ -66,7 +66,18 @@ static int pipe_seek(void *handle, long offset, int whence) struct lbx_pipe_state *state = handle; long distance; - distance = offset - state->offset; + switch (whence) { + case SEEK_SET: + distance = offset - state->offset; + break; + case SEEK_CUR: + distance = offset; + break; + case SEEK_END: + distance = -1; + break; + } + if (distance < 0) return -1;