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.
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;