From a927a6370c2f21cd6ff44c623cba670fdb9aaf13 Mon Sep 17 00:00:00 2001 From: Jens Georg Date: Wed, 2 Oct 2019 00:01:55 +0200 Subject: engine-simple: Use IOError.from_errno --- src/media-engines/simple/rygel-simple-data-source.vala | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/media-engines/simple/rygel-simple-data-source.vala b/src/media-engines/simple/rygel-simple-data-source.vala index 1fc74017..f884e7fa 100644 --- a/src/media-engines/simple/rygel-simple-data-source.vala +++ b/src/media-engines/simple/rygel-simple-data-source.vala @@ -144,9 +144,7 @@ internal class Rygel.SimpleDataSource : DataSource, Object { try { fd = Posix.open (file.get_path (), Posix.O_RDONLY, 0); if (fd < 0) { - throw new IOError.FAILED ("Failed to open file '%s': %s", - file.get_path (), - Posix.strerror (Posix.errno)); + throw IOError.from_errno (errno); } if (this.last_byte == 0) { @@ -191,9 +189,7 @@ internal class Rygel.SimpleDataSource : DataSource, Object { var slice = new uint8[stop - start]; var len = (int) Posix.read (fd, slice, slice.length); if (len < 0) { - throw new IOError.FAILED ("Failed to read file '%s': %s", - file.get_path (), - Posix.strerror (Posix.errno)); + throw IOError.from_errno (errno); } slice.length = len; -- cgit v1.2.1