mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-29 17:38:02 -04:00
Fix unexpected behavior of --lock when keepassxc is not running (#8889)
currently, when keepassxc is not running, the command `keepassxc --lock` opens a new keepass window and blocks until the window is closed. Especially in locking scripts this is rather unexpected and Ican't think of a case where someone explicitly starts keepass with --lock and wants this behaviour. Rather --lock should always ensure, that there are no unlocked instances and exiting afterwards
This commit is contained in:
parent
f381e29f3a
commit
03ad6c52c0
@ -7861,6 +7861,10 @@ Kernel: %3 %4</source>
|
|||||||
This options is deprecated, use --set-key-file instead.</source>
|
This options is deprecated, use --set-key-file instead.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>KeePassXC is not running. No open database to lock</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>QtIOCompressor</name>
|
<name>QtIOCompressor</name>
|
||||||
|
@ -156,6 +156,14 @@ int main(int argc, char** argv)
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parser.isSet(lockOption)) {
|
||||||
|
qWarning() << QObject::tr("KeePassXC is not running. No open database to lock").toUtf8().constData();
|
||||||
|
|
||||||
|
// still return with EXIT_SUCCESS because when used within a script for ensuring that there is no unlocked
|
||||||
|
// keepass database (e.g. screen locking) we can consider it as successful
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Crypto::init()) {
|
if (!Crypto::init()) {
|
||||||
QString error = QObject::tr("Fatal error while testing the cryptographic functions.");
|
QString error = QObject::tr("Fatal error while testing the cryptographic functions.");
|
||||||
error.append("\n");
|
error.append("\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user