From f806e268c6c3a76f65b1282219e16fcdfb80a9b5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 22 Aug 2013 18:23:33 +0200 Subject: stream: don't require streams to set s->pos in seek callback Instead, set s->pos depending on the success of the seek callback. --- stream/stream_file.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'stream/stream_file.c') diff --git a/stream/stream_file.c b/stream/stream_file.c index a8dcf8fbdb..87e77d7bf3 100644 --- a/stream/stream_file.c +++ b/stream/stream_file.c @@ -63,10 +63,7 @@ static int write_buffer(stream_t *s, char *buffer, int len) static int seek(stream_t *s, int64_t newpos) { struct priv *p = s->priv; - s->pos = newpos; - if (lseek(p->fd, s->pos, SEEK_SET) < 0) - return 0; - return 1; + return lseek(p->fd, newpos, SEEK_SET) != (off_t)-1; } static int control(stream_t *s, int cmd, void *arg) -- cgit v1.2.3