[simple-scan/cherry-pick-3ac5c61d] Display error message if unable to open simple-scan.log file




commit 6abf1da7410ca85f76f6caa4034a45d3c54eea34
Author: Bartosz Kosiorek <gang65 poczta onet pl>
Date:   Tue Sep 1 20:51:13 2020 +0000

    Display error message if unable to open simple-scan.log file
    
    Fix: #192
    
    
    (cherry picked from commit 3ac5c61da0d3636741f7ac884a01e75057d136ff)

 src/simple-scan.vala | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/simple-scan.vala b/src/simple-scan.vala
index 771dc82a..c41bebec 100644
--- a/src/simple-scan.vala
+++ b/src/simple-scan.vala
@@ -1695,7 +1695,7 @@ public class SimpleScan : Gtk.Application
             }
             catch (Error e)
             {
-                stderr.printf ("Error fixing PDF file: %s", e.message);
+                stderr.printf ("Error fixing PDF file: %s\n", e.message);
                 return Posix.EXIT_FAILURE;
             }
             return Posix.EXIT_SUCCESS;
@@ -1715,6 +1715,11 @@ public class SimpleScan : Gtk.Application
         DirUtils.create_with_parents (path, 0700);
         path = Path.build_filename (Environment.get_user_cache_dir (), "simple-scan", "simple-scan.log", 
null);
         log_file = FileStream.open (path, "w");
+        if (log_file == null )
+        {
+            stderr.printf ("Error: Unable to open %s file for writing\n", path);
+            return Posix.EXIT_FAILURE;
+        }
         Log.set_default_handler (log_cb);
 
         debug ("Starting %s %s, PID=%i", args[0], VERSION, Posix.getpid ());


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