gnucash maint: Warn if can't lock for any reason other than that the file is locked already.

John Ralls jralls at code.gnucash.org
Fri Jun 28 14:49:20 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/a3871d9c (commit)
	from  https://github.com/Gnucash/gnucash/commit/9ed0174c (commit)



commit a3871d9ca1b12fa1635d1ac7f3781c4a490030ef
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Jun 23 11:01:29 2019 -0700

    Warn if can't lock for any reason other than that the file is locked already.
    
    And include the error string in the message.

diff --git a/libgnucash/backend/xml/gnc-xml-backend.cpp b/libgnucash/backend/xml/gnc-xml-backend.cpp
index 5242723c2..d652b7810 100644
--- a/libgnucash/backend/xml/gnc-xml-backend.cpp
+++ b/libgnucash/backend/xml/gnc-xml-backend.cpp
@@ -652,14 +652,15 @@ GncXmlBackend::get_file_lock ()
         case EACCES:
         case EROFS:
         case ENOSPC:
-            PWARN ("Unable to create the lockfile %s; may not have write priv",
-                   m_lockfile.c_str());
             be_err = ERR_BACKEND_READONLY;
             break;
         default:
             be_err = ERR_BACKEND_LOCKED;
             break;
         }
+        if (errno != EEXIST) // Can't lock, but not because the file is locked
+            PWARN ("Unable to create the lockfile %s: %s",
+                   m_lockfile.c_str(), strerror(errno));
         set_error(be_err);
         return false;
     }



Summary of changes:
 libgnucash/backend/xml/gnc-xml-backend.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list