sane-project-website/old-archive/2000-06/0237.html

198 wiersze
6.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>sane-devel: Re: bug in saned</TITLE>
<META NAME="Author" CONTENT="Jochen Eisinger (jochen.eisinger@gno.de)">
<META NAME="Subject" CONTENT="Re: bug in saned">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Re: bug in saned</H1>
<!-- received="Fri Jun 30 14:12:41 2000" -->
<!-- isoreceived="20000630211241" -->
<!-- sent="Fri, 30 Jun 2000 23:23:46 +0200" -->
<!-- isosent="20000630212346" -->
<!-- name="Jochen Eisinger" -->
<!-- email="jochen.eisinger@gno.de" -->
<!-- subject="Re: bug in saned" -->
<!-- id="395D0FE2.B9E62D52@gno.de" -->
<!-- inreplyto="200006300418.MAA19387@localhost.localdomain" -->
<STRONG>From:</STRONG> Jochen Eisinger (<A HREF="mailto:jochen.eisinger@gno.de?Subject=Re:%20bug%20in%20saned&In-Reply-To=&lt;395D0FE2.B9E62D52@gno.de&gt;"><EM>jochen.eisinger@gno.de</EM></A>)<BR>
<STRONG>Date:</STRONG> Fri Jun 30 2000 - 14:23:46 PDT
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0238.html">Joachim Ansorg: "Re: Problems with mustek scanner"</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0236.html">mh: "Sane API problem: multiple sane_init calls"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0224.html">Petter Reinholdtsen: "Re: bug in saned"</A>
<!-- nextthread="start" -->
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#237">[ date ]</A>
<A HREF="index.html#237">[ thread ]</A>
<A HREF="subject.html#237">[ subject ]</A>
<A HREF="author.html#237">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
Hi,
<BR>
<P><EM>&gt; Why where SIGPIPE not catched in the first place? Do you have a
</EM><BR>
<EM>&gt; patch? Could this bug be related to the problem people reports when
</EM><BR>
<EM>&gt; running a net scanner on localhost?
</EM><BR>
<P>Sorry, I don't really understand what you mean by &quot;catched in the first
<BR>
place&quot;... saned has a sighandler installed for sigpipe and this handler
<BR>
is callen (if you start saned with -d128 you can see the signo) and
<BR>
saned exits. the net backend afterwards crashes (because it thinks saned
<BR>
is still running...)
<BR>
<P>I've attached a patch against the saned.c from the 1.0.2 distribution...
<BR>
<P>-- jochen
<BR>
<BR><P>
--- frontend/saned.c Sun Mar 5 14:44:45 2000
<BR>
+++ saned.c Fri Jun 30 23:18:41 2000
<BR>
@@ -100,6 +100,7 @@
<BR>
&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;u_int inuse : 1; /* is this handle in use? */
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;u_int scanning : 1; /* are we scanning? */
<BR>
+ u_int docancel : 1; /* cancel the current scan */
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SANE_Handle handle; /* backends handle */
<BR>
&nbsp;&nbsp;&nbsp;}
<BR>
&nbsp;Handle;
<BR>
@@ -524,7 +525,10 @@
<BR>
&nbsp;
<BR>
&nbsp;&nbsp;&nbsp;reply-&gt;status = sane_start (be_handle);
<BR>
&nbsp;&nbsp;&nbsp;if (reply-&gt;status == SANE_STATUS_GOOD)
<BR>
- handle[h].scanning = 1;
<BR>
+ {
<BR>
+ handle[h].scanning = 1;
<BR>
+ handle[h].docancel = 0;
<BR>
+ }
<BR>
&nbsp;
<BR>
&nbsp;&nbsp;&nbsp;return fd;
<BR>
&nbsp;}
<BR>
@@ -674,10 +678,13 @@
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DBG(4, &quot;do_scan: processing RPC request on fd %d\n&quot;, w-&gt;io.fd);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;process_request (w);
<BR>
+ if (handle[h].docancel)
<BR>
+ break;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
<BR>
&nbsp;&nbsp;&nbsp;while (status == SANE_STATUS_GOOD || bytes_in_buf &gt; 0 || status_dirty);
<BR>
&nbsp;&nbsp;&nbsp;DBG(2, &quot;do_scan: done, status=%s\n&quot;, sane_strstatus (status));
<BR>
+ handle[h].docancel = 0;
<BR>
&nbsp;&nbsp;&nbsp;handle[h].scanning = 0;
<BR>
&nbsp;}
<BR>
&nbsp;
<BR>
@@ -854,6 +861,7 @@
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sane_cancel (handle[h].handle);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;handle[h].scanning = 0;
<BR>
+ handle[h].docancel = 0;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;syslog (LOG_ERR, &quot;process_request: accept failed! (%s)\n&quot;,
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strerror (errno));
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;
<BR>
@@ -872,6 +880,7 @@
<BR>
&nbsp;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h = decode_handle (w, &quot;cancel&quot;);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sane_cancel (handle[h].handle);
<BR>
+ handle[h].docancel=1;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sanei_w_reply (w, (WireCodecFunc) sanei_w_word, &amp;ack);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
<BR>
<P><P><P><PRE>
--
Source code, list archive, and docs: <A HREF="http://www.mostang.com/sane/">http://www.mostang.com/sane/</A>
To unsubscribe: echo unsubscribe sane-devel | mail <A HREF="mailto:majordomo@mostang.com?Subject=Re:%20bug%20in%20saned&In-Reply-To=&lt;395D0FE2.B9E62D52@gno.de&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0238.html">Joachim Ansorg: "Re: Problems with mustek scanner"</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0236.html">mh: "Sane API problem: multiple sane_init calls"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0224.html">Petter Reinholdtsen: "Re: bug in saned"</A>
<!-- nextthread="start" -->
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#237">[ date ]</A>
<A HREF="index.html#237">[ thread ]</A>
<A HREF="subject.html#237">[ subject ]</A>
<A HREF="author.html#237">[ author ]</A>
</UL>
<!-- trailer="footer" -->
<HR NOSHADE>
<P>
<SMALL>
<EM>
This archive was generated by <A HREF="http://www.hypermail.org/">hypermail 2b29</A>
: <EM>Fri Jun 30 2000 - 14:14:12 PDT</EM>
</EM>
</SMALL>
</BODY>
</HTML>