Make sure that the result of the reader_process is interpreted

correctly. Block signals when waiting for a SCSI request to finish. Otherwise
we may get a segfault if the reader_process is terminated while waiting.
merge-requests/1/head
Henning Geinitz 2003-02-17 12:05:56 +00:00
rodzic 57e852ea8a
commit b9a6e5cc4a
4 zmienionych plików z 43 dodań i 11 usunięć

Wyświetl plik

@ -1,3 +1,11 @@
2003-02-17 Henning Meier-Geinitz <henning@meier-geinitz.de>
* backend/mustek.c doc/descriptions/mustek.desc
doc/mustek/mustek.CHANGES: Make sure that the result of the
reader_process is interpreted correctly. Block signals when waiting
for a SCSI request to finish. Otherwise we may get a segfault if the
reader_process is terminated while waiting.
2003-02-16 Henning Meier-Geinitz <henning@meier-geinitz.de>
* doc/doxygen-sanei.conf: Updated version.

Wyświetl plik

@ -46,7 +46,7 @@
/**************************************************************************/
/* Mustek backend version */
#define BUILD 130
#define BUILD 131
/**************************************************************************/
#include "../include/sane/config.h"
@ -2843,17 +2843,31 @@ do_stop (Mustek_Scanner * s)
/* ensure child knows it's time to stop: */
DBG (5, "do_stop: terminating reader process\n");
kill (s->reader_pid, SIGTERM);
pid = waitpid (s->reader_pid, &exit_status, 0);
if (pid < 0)
{
DBG (1, "do_stop: waitpid failed, already terminated? (%s)\n",
strerror (errno));
}
else if (WIFEXITED (exit_status))
{
DBG (2, "do_stop: reader process terminated with status %s\n",
sane_strstatus (WEXITSTATUS (exit_status)));
if (status != SANE_STATUS_CANCELLED
&& WEXITSTATUS (exit_status) != SANE_STATUS_GOOD)
status = WEXITSTATUS (exit_status);
}
else if (WIFSIGNALED (status))
{
DBG (2, "do_stop: reader process was terminated by signal %d\n",
WTERMSIG (exit_status));
if (WTERMSIG (exit_status) != 15)
status = SANE_STATUS_IO_ERROR;
}
else
DBG (1, "do_stop: reader process terminated by unknown reason\n");
if (status != SANE_STATUS_CANCELLED && pid > 0
&& WIFEXITED (exit_status))
status = WEXITSTATUS (exit_status);
DBG (5, "do_stop: reader process terminated: %s\n",
sane_strstatus (status));
if (pid <= 0)
DBG (5, "do_stop: reader process already terminated (%s)\n",
strerror (errno));
s->reader_pid = 0;
}
@ -4839,7 +4853,9 @@ reader_process (Mustek_Scanner * s, SANE_Int fd)
{
DBG (4, "reader_process: buffer %d: waiting for request to be "
"ready\n", buffernumber + 1);
sigprocmask (SIG_BLOCK, &sigterm_set, 0);
status = dev_req_wait (bstat[buffernumber].id);
sigprocmask (SIG_UNBLOCK, &sigterm_set, 0);
if (status == SANE_STATUS_GOOD)
{
DBG (4, "reader_process: buffer %d is ready, wanted %d, "

Wyświetl plik

@ -9,7 +9,7 @@
;
:backend "mustek" ; name of backend
:version "1.0-130" ; version of backend
:version "1.0-131" ; version of backend
:status :stable ; :alpha, :beta, :stable, :new
:manpage "sane-mustek" ; name of manpage (if it exists)
:url "http://www.meier-geinitz.de/sane/mustek-backend/"

Wyświetl plik

@ -1,5 +1,13 @@
CHANGES for the SANE Mustek backend
2003-02-17
* Released Mustek backend 1.0-131
2003-02-17
* Make sure that the result of the reader_process is interpreted correctly.
* Block signals when waiting for a SCSI request to finish. Otherwise we may
get a segfault if the reader_process is terminated while waiting.
2002-11-29
* Released Mustek backend 1.0-130