[rygel] engine-simple: Use IOError.from_errno



commit a927a6370c2f21cd6ff44c623cba670fdb9aaf13
Author: Jens Georg <mail jensge org>
Date:   Wed Oct 2 00:01:55 2019 +0200

    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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]