Check return value of waitpid. Don't evaluate status of children if waitpid

wasn't successful.
Henning Meier-Geinitz <henning@meier-geinitz.de>
DEVEL_2_0_BRANCH-1
Henning Geinitz 2002-05-05 13:15:49 +00:00
rodzic a34ce8e8ad
commit f28fc112e0
2 zmienionych plików z 10 dodań i 5 usunięć

Wyświetl plik

@ -41,7 +41,7 @@
This backend is for testing frontends.
*/
#define BUILD 14
#define BUILD 15
#include "../include/sane/config.h"
@ -1218,13 +1218,18 @@ finish_pass (Test_Device * test_device)
if (test_device->reader_pid > 0)
{
int status;
int pid;
DBG (2, "finish_pass: terminating reader process %d\n",
test_device->reader_pid);
kill (test_device->reader_pid, SIGTERM);
waitpid (test_device->reader_pid, &status, 0);
if (WIFEXITED (status))
pid = waitpid (test_device->reader_pid, &status, 0);
if (pid < 0)
{
DBG (1, "finish_pass: waitpid failed, already terminated? (%s)\n",
strerror (errno));
}
else if (WIFEXITED (status))
{
DBG (2, "finish_pass: reader process terminated with status %s\n",
sane_strstatus (WEXITSTATUS (status)));

Wyświetl plik

@ -10,7 +10,7 @@
;
:backend "test" ; name of backend
:version "1.0-14" ; version of backend
:version "1.0-15" ; version of backend
:status :beta ; :alpha, :beta, :stable, :new
:manpage "sane-test" ; name of manpage (if it exists)
:url "http://www.meier-geinitz.de/sane/test-backend/" ; backend's web page