core: rework ask_for_confirmation()
authorFranck Bui <fbui@suse.com>
Wed, 2 Nov 2016 12:51:02 +0000 (13:51 +0100)
committerFranck Bui <fbui@suse.com>
Thu, 17 Nov 2016 17:16:49 +0000 (18:16 +0100)
commit3b20f877ade5599dab124474055d2e56c3dcdb15
tree4b6f001ff5d9c783932c49ae00dbbd9ff992e4e5
parent7d5ceb641659b29204598fde9110913765c2aa9e
core: rework ask_for_confirmation()

Now the reponses are handled by ask_for_confirmation() as well as the report of
any errors occuring during the process of retrieving the confirmation response.

One benefit of this is that there's no need to open/close the console one more
time when reporting error/status messages.

The caller now just needs to care about the return values whose meanings are:

 - don't execute and pretend that the command failed
 - don't execute and pretend that the command succeeed
 - positive answer, execute the command

Also some slight code reorganization and introduce write_confirm_error() and
write_confirm_error_fd(). write_confim_message becomes unneeded.
src/core/execute.c