--- scsicmds.c.orig     2009-02-23 00:16:15.000000000 +0100
+++ scsicmds.c  2009-02-22 23:49:50.000000000 +0100
@@ -44,27 +44,6 @@
 // Application specific includes
 #include "scsicmds.h"
 
-static void scsi_fixstring(unsigned char *s, int bytecount)
-{
-  unsigned char *p;
-  unsigned char *end;
-
-  p = s;
-  end = s + bytecount;
-
-  /* strip leading blanks */
-  while (s != end && *s == ' ')
-    ++s;
-  /* compress internal blanks and strip trailing blanks */
-  while (s != end && *s) {
-    if (*s++ != ' ' || (s != end && *s && *s != ' '))
-      *p++ = *(s-1);
-  }
-  /* wipe out trailing garbage */
-  while (p != end)
-    *p++ = '\0';
-}
-
 int scsi_SG_IO(int device, unsigned char *cdb, int cdb_len, unsigned
char *buffer, int buffer_len, unsigned char *sense, unsigned char
sense_len, int dxfer_direction) {
   struct sg_io_hdr io_hdr;
 
@@ -146,7 +125,6 @@
   if (scsi_command(device, cdb, sizeof(cdb), buffer, cdb[4],
SG_DXFER_FROM_DEV) != 0)
     return 1;
   else {
-    scsi_fixstring(buffer + 8, 24);
     return 0;
   }
 }
--- scsi.c.orig 2009-02-23 00:16:06.000000000 +0100
+++ scsi.c      2009-02-22 23:52:17.000000000 +0100
@@ -57,12 +57,35 @@
     return 1;
 }
 
+static void scsi_fixstring(unsigned char *s, int bytecount)
+{
+  unsigned char *p;
+  unsigned char *end;
+
+  p = s;
+  end = s + bytecount;
+
+  /* strip leading blanks */
+  while (s != end && *s == ' ')
+    ++s;
+  /* compress internal blanks and strip trailing blanks */
+  while (s != end && *s) {
+    if (*s++ != ' ' || (s != end && *s && *s != ' '))
+      *p++ = *(s-1);
+  }
+  /* wipe out trailing garbage */
+  while (p != end)
+    *p++ = '\0';
+}
+
 static const char *scsi_model (int device) {
   unsigned char buf[36];
 
   if (scsi_inquiry(device, buf) != 0)
     return strdup(_("unknown"));
   else {
+    scsi_fixstring(buf + 8, 24);
+    buf[32] = '\0';
     return strdup(buf + 8);
   }
 }

-- 

Dipl.-Inform. Thomas Kindler, 
[email protected] +49-(0)208/9963-346
Lenord, Bauer & Co. GmbH / Abt. CEE
Dohlenstrasse 32, D46145-Oberhausen



Lenord, Bauer & Co. GmbH - Dohlenstrasse 32 - 46145 Oberhausen - Germany
Geschäftsführer/Managing director: Hans-Georg Wilk
Amtsgericht/Trade register: Duisburg HRB 12033
Tel.: +49 (0)208 9963-0 - Fax: +49 (0)208 676292
Internet: www.lenord.de - E-Mail: [email protected]

Besuchen Sie unsere Website und abonnieren Sie unseren Newsletter unter
www.lenord.de/newsletter. So bleiben Sie stets auf dem Laufenden! 
Visit our website and subscribe to our newsletter at
www.lenord.de/newsletter. It keeps you up to date!



--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to