cpp: Go with default answer on unknown question by key edit interface
* lang/cpp/src/editinteractor.cpp (edit_interactor_callback_impl): Send empty string to edit interface if General Error occurred. -- A General Error is usually returned by the nextState function of the concrete EditInteractor subclasses if gpg asks an unexpected question which isn't handled by the edit interactor's state machine. In this case, it's usually safe to go with the default answer. This makes the edit interactors much more robust. GnuPG-bug-id: 7274
This commit is contained in:
parent
409e314582
commit
7579c40124
@ -167,6 +167,20 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
if (err.code() == GPG_ERR_GENERAL) {
|
||||||
|
// gpg may have asked an unknown question; try to use the default answer
|
||||||
|
if (ei->debug) {
|
||||||
|
std::fprintf(ei->debug, "EditInteractor: action result \"%s\" (go with the default answer)\n", "");
|
||||||
|
}
|
||||||
|
if (writeAll(fd, "\n", 1) != 1) {
|
||||||
|
err = Error::fromSystemError();
|
||||||
|
if (ei->debug) {
|
||||||
|
std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asStdString().c_str());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = Error();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (err || err.isCanceled()) {
|
if (err || err.isCanceled()) {
|
||||||
ei->error = err;
|
ei->error = err;
|
||||||
ei->state = EditInteractor::ErrorState;
|
ei->state = EditInteractor::ErrorState;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user