[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ha-dev
Subject:    [Linux-ha-dev] Patch fix: ssh STONITH device
From:       "Zou, Yixiong" <yixiong.zou () intel ! com>
Date:       2003-08-21 23:40:52
[Download RAW message or body]

On my box, which is running RedHat 9, every time I do a 
'stonith -t ssh -l', instead of return something like

    coldplay
    delerium

it always returns 

    coldplay/sto
    delerium

And here's the patch that fixes this bug. 

strncpy() will only pad the remaining of the string if
the length is longer than the src passed in.  In this case,
the src is longer than the length, so strncpy() did not
pad the buffer. 

One more thing that is not a big deal but very annoying is
that almost all the STONITH drivers do fopen() but none
of them do fclose() except the vacm device.  I suppose the
resource is released when the child process exit.  But it
is still a good idea to do that explicitly. 

I can supply a patch if you guys agree. 

------------------------------------------------------------------------
Yixiong Zou (yixiong.zou@intel.com)
(503) 677-4988

All views expressed in this email are those of the individual sender.  

Index: ssh.c
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/plugins/stonith/ssh.c,v
retrieving revision 1.7
diff -u -r1.7 ssh.c
--- ssh.c	7 Feb 2003 08:37:18 -0000	1.7
+++ ssh.c	21 Aug 2003 23:17:49 -0000
@@ -308,6 +308,7 @@
 	ret = NULL;
 	return S_OOPS;
       }
+      memset(ret[j], 0, 1+(s-start));
       strncpy(ret[j], start, (s-start));
     }
   }
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic