From 958926fd7382d2c44828cdc70ca6c27bb281ff0d Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Thu, 4 Feb 2010 11:47:18 -0500 Subject: [PATCH] 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. --- src/fops.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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; -- 2.43.2