[gnucash-commands] don't force open a locked datafile

qof_session_begin (..., ..., ignore_lock=TRUE, ..., ...) will
force-open a datafile currently in use in another session.

This will unfortunately delete any existing .LCK file.

To my knowledge there is no read-only qofsession which will leave .LCK
file intact. Therefore to prevent possible dataloss, it is best to
disallow opening a locked file which prevents deletion of .LCK file.
pull/730/head
Christopher Lam 6 years ago
parent fe09c45d17
commit 658241d3be

@ -168,9 +168,12 @@ scm_run_report (void *data,
if (!session)
scm_cleanup_and_exit_with_failure (session);
qof_session_begin (session, datafile, TRUE, FALSE, FALSE);
qof_session_begin (session, datafile, FALSE, FALSE, FALSE);
if (qof_session_get_error (session) != ERR_BACKEND_NO_ERR)
{
fprintf (stderr, "ERROR: datafile not found, or locked in another session\n");
scm_cleanup_and_exit_with_failure (session);
}
qof_session_load (session, report_session_percentage);
if (qof_session_get_error (session) != ERR_BACKEND_NO_ERR)

Loading…
Cancel
Save