aboutsummaryrefslogtreecommitdiffstats
path: root/src/archive/ZzipArchivePlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-11-24 22:08:11 +0100
committerMax Kellermann <max@duempel.org>2014-11-24 22:08:50 +0100
commita254f5a3a8396865cf05e27e0ab03345ee66783a (patch)
treea987865a947a7fd812d6de709074e8e59e54cdda /src/archive/ZzipArchivePlugin.cxx
parent143c735f967f84325c56cb042cb5157e77739aa7 (diff)
downloadmpd-a254f5a3a8396865cf05e27e0ab03345ee66783a.tar.gz
mpd-a254f5a3a8396865cf05e27e0ab03345ee66783a.tar.xz
mpd-a254f5a3a8396865cf05e27e0ab03345ee66783a.zip
archive/zzip: fix inverted error handler
Set the Error when zzip_seek()==-1 and not on success. Fixes a crash after seeking.
Diffstat (limited to 'src/archive/ZzipArchivePlugin.cxx')
-rw-r--r--src/archive/ZzipArchivePlugin.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/archive/ZzipArchivePlugin.cxx b/src/archive/ZzipArchivePlugin.cxx
index 973fe91dc..d3e4cc837 100644
--- a/src/archive/ZzipArchivePlugin.cxx
+++ b/src/archive/ZzipArchivePlugin.cxx
@@ -186,12 +186,13 @@ zzip_input_seek(InputStream *is, InputPlugin::offset_type offset,
{
ZzipInputStream *zis = (ZzipInputStream *)is;
zzip_off_t ofs = zzip_seek(zis->file, offset, whence);
- if (ofs != -1) {
+ if (ofs < 0) {
error.Set(zzip_domain, "zzip_seek() has failed");
- is->offset = ofs;
- return true;
+ return false;
}
- return false;
+
+ is->offset = ofs;
+ return true;
}
/* exported structures */