On Tue, 15 Apr 2008, David Lee wrote:
> On Tue, 15 Apr 2008, Jan Chaloupecky wrote:
>
> [...]
> > Yes, I read your following email exange in the mailing list archive:
> > http://www.gossamer-threads.com/lists/linuxha/users/40766?search_string=%2Bheartbeat%20%2Bk%20%2BSolaris;#40766
> >
>
> Yes, that looks like it. Thanks for digging it out.
I've been able to find a little time to look at this. I've taken the
modifications done to heartbeat/heartbeat.c as part of bug 1576 and have
rewritten the relevant part of lib/stonith/expect.c to try to do the same
thing.
Alas, I'm still unable to test this. But could you (and any other
readers!) try the attached patch?
As I understand it, the intention of the heartbeat coding is that the
'cmd' that is exec'd ought to be the direct child of the process. But on
Solaris (perhaps 'sh' rather than 'bash') it instead became the
grandchild. (The Solaris 'ptree' command should show the 'family tree'.)
My patch ought to make this the child.
Linux: should be exactly as before.
Solaris: should be different, as direct child.
Repeat warning: completely untested!
--
: David Lee I.T. Service :
: Senior Systems Programmer Computer Centre :
: UNIX Team Leader Durham University :
: South Road :
: http://www.dur.ac.uk/t.d.lee/ Durham DH1 3LE :
: Phone: +44 191 334 2752 U.K. :
--- lib/stonith/expect.c.orig Mon Feb 18 17:22:36 2008
+++ lib/stonith/expect.c Tue Apr 22 12:14:33 2008
@@ -318,7 +318,21 @@
sched_setscheduler(0, SCHED_OTHER, &sp);
}
#endif
- execlp("/bin/sh", "sh", "-c", cmd, (const char
*)NULL);
+ {
+ char *cmdexec = NULL;
+ size_t cmdsize;
+#define CMDPREFIX "exec "
+
+ cmdsize = STRLEN_CONST(CMDPREFIX) + strlen(cmd)
+ 1;
+ cmdexec = MALLOC(cmdsize);
+ if (cmdexec != NULL) {
+ strlcpy(cmdexec, CMDPREFIX, cmdsize);
+ strlcat(cmdexec, cmd, cmdsize);
+ (void)execlp("/bin/sh", "sh", "-c",
+ cmdexec, (const char *)NULL);
+ }
+ }
+ /* Should not happen */
perror("cannot exec shell!");
exit(1);
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems