monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: monit control.c


From: Rory Toma
Subject: RE: monit control.c
Date: 08 Oct 2002 17:08:42 -0700

Hmmm... Seems to work OK when I tested it, but...

Can you revert the change, then?

On Tue, 2002-10-08 at 17:03, Jan-Henrik Haukeland wrote:
> > Modified files:
> >     .              : control.c
> >
> > Log message:
> >     Tidy up a bit. Create a function that tests and returns stop/start
> >     script.
> 
> +/*
> + * Return a pointer to start/stop Command_T object
> + * @param p A Process T object @param action A start/stop action
> + */
> +Command_T check_script(Process_T p, char *action) {
> +
> +  Command_T c = NULL;
> +
> +  if(is(action, "start")) {
> +    c= p->start;
> +  }
> +  else if(is(action, "stop")) {
> +    c= p->stop;
> +  }
> +
> +  return c;
> +
>  }
> 
> This will not work, you cannot return a object from a function unless it's
> allocated. A better solution could be something like (untested):
> 
> int has_script(Process_T p char *action) {
> 
>  if((is(action, "start") && p->start)||(is(action, "stop") && p->stop))
>    return TRUE;
>  return FALSE;
> 
> }
> 
> Jan-Henrik
> 
> 
> 
> _______________________________________________
> monit-dev mailing list
> address@hidden
> http://mail.freesoftware.fsf.org/mailman/listinfo/monit-dev
> 
-- 
Rory Toma               address@hidden
VP of Run Level 5       http://www.trs80.net
Digeo Digital           http://www.digeo.com

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]