[rygel] engine-simple: Obey lseek return value
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] engine-simple: Obey lseek return value
- Date: Tue, 1 Oct 2019 22:06:05 +0000 (UTC)
commit 4d02b78b5c897b5087396111f26c48f21e49246e
Author: Jens Georg <mail jensge org>
Date: Wed Oct 2 00:01:24 2019 +0200
engine-simple: Obey lseek return value
Fixes #138
src/media-engines/simple/rygel-simple-data-source.vala | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/media-engines/simple/rygel-simple-data-source.vala
b/src/media-engines/simple/rygel-simple-data-source.vala
index f99e3099..1fc74017 100644
--- a/src/media-engines/simple/rygel-simple-data-source.vala
+++ b/src/media-engines/simple/rygel-simple-data-source.vala
@@ -151,11 +151,19 @@ internal class Rygel.SimpleDataSource : DataSource, Object {
if (this.last_byte == 0) {
this.last_byte = Posix.lseek (fd, 0, Posix.SEEK_END);
- Posix.lseek (fd, 0, Posix.SEEK_SET);
+ if (this.last_byte < 0) {
+ throw IOError.from_errno (errno);
+ }
+
+ if (Posix.lseek (fd, 0, Posix.SEEK_SET) < 0) {
+ throw IOError.from_errno (errno);
+ }
+
}
if (this.first_byte != 0) {
- Posix.lseek (fd, this.first_byte, Posix.SEEK_SET);
+ if (Posix.lseek (fd, this.first_byte, Posix.SEEK_SET) < 0)
+ throw IOError.from_errno (errno);
}
while (true) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]