[patch] 0.9.7: fix LPGETSTATUS call

Tim Waugh <[email protected]> Fri, 25 Nov 2005 13:53:43 +0000
Newsgroups gmane.linux.drivers.hpofficejet.devel
Message-ID <[email protected]>
Hi,

Here is a patch to fix the storage size of the variable provided to
accept the data from the LPGETSTATUS ioctl.  This control returns
sizeof(int) bytes.

The symptom that lead me to investigate this was that hpiod was
send()ing "" -- the res variable was getting overwritten with zeros.

Tim.
*/

--- hplip-0.9.7/io/hpiod/device.cpp.lpgetstatus	2005-11-25 12:55:05.000000000 +0000
+++ hplip-0.9.7/io/hpiod/device.cpp	2005-11-25 12:56:13.000000000 +0000
@@ -392,9 +392,9 @@
 
 int Device::GetDeviceStatus(char *sendBuf, int *result)
 {
-   char res[] = "msg=DeviceStatusResult\nresult-code=%d\nstatus-code=%d\nstatus-name=%s\n";
+   const char res[] = "msg=DeviceStatusResult\nresult-code=%d\nstatus-code=%d\nstatus-name=%s\n";
    int len=0, r;
-   unsigned char status;
+   unsigned int status;
    char vstatus[16];
 
    *result = R_AOK;


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click