taler-mdb

GNU Taler Extensions and Integrations
Log | Files | Refs | Submodules | README | LICENSE

commit 7fbf2a31d95a864b707207aae87e1eb1d6910197
parent 8dd0914484eb82dd2f8a4384ce5e631fb257ba3a
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 27 Mar 2020 13:28:00 +0100

fix checking of syscall rvals

Diffstat:
Msrc/main.c | 23+++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/main.c b/src/main.c @@ -1080,7 +1080,7 @@ shutdown_task (void *cls) } if (0 < cancel_button.cancelbuttonfd) { - close (cancel_button.cancelbuttonfd); + GNUNET_break (0 == close (cancel_button.cancelbuttonfd)); cancel_button.cancelbuttonfd = open ("/sys/class/gpio/unexport", O_WRONLY); if (0 > cancel_button.cancelbuttonfd) @@ -1088,10 +1088,19 @@ shutdown_task (void *cls) GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to open /gpio/unexport for cancel button\n"); } - (void) ! write (cancel_button.cancelbuttonfd, - "23", - 2); - close (cancel_button.cancelbuttonfd); + else + { + if (2 != write (cancel_button.cancelbuttonfd, + "23", + 2)) + { + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, + "write", + "/sys/class/gpio/unexport"); + + } + GNUNET_break (0 == close (cancel_button.cancelbuttonfd)); + } } /* free the allocated productes read from config file */ if (NULL != products) @@ -1845,7 +1854,9 @@ cancel_button_pressed (void *cls) return; } - lseek (cancel_button.cancelbuttonfd, 0, SEEK_SET); + GNUNET_break (0 == lseek (cancel_button.cancelbuttonfd, + 0, + SEEK_SET)); /* This point should only be reached when a order is pending, because * the scheduler read file gets added in the function "launch_payment". * But anyway safe check, else do nothing */