[sane-devel] [patch] fix SCSI device matching

Tim Waugh twaugh@redhat.com
Thu, 25 Oct 2001 18:21:23 +0100


When a SCSI device returns a blank string field (such as the vendor
field), sanei_scsi_find_devices gets confused.

See <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=55092>.

I append a patch that I think will fix it.  What do you think?

Tim.
*/

Index: sane-backends/sanei/sanei_scsi.c
===================================================================
RCS file: /cvsroot/external/sane/sane-backends/sanei/sanei_scsi.c,v
retrieving revision 1.25
diff -d -u -r1.25 sanei_scsi.c
--- sanei_scsi.c	2001/09/21 11:29:13	1.25
+++ sanei_scsi.c	2001/10/25 17:19:29
@@ -2511,6 +2511,13 @@
 		      else
 		         *param[i].u.i = 0;
 		    }
+		  else if (i < NELEMS (param) &&
+			   strncmp (string, param[i + 1].name,
+				    param[i + 1].name_len) == 0)
+		    {
+		      /* Seems like this field is all whitespace */
+		      param[i].u.str[0] = '\0';
+		    }
 		  else
 		    {
 		      strncpy (param[i].u.str, string, 32);