THanks Matt

Matt Richards wrote:
> Greeetings. I believe I have found a bug in cf-serverd for AIX. In
> StartServer (server.c):
> 
>   struct Attributes dummyattr;
> 
> dummyattr comes prefilled with garbage, which affects locking later in
> AcquireLock (transactions.c):
> 
> if (elapsedtime < attr.transaction.ifelapsed)
>    {
>    CfOut(cf_verbose,""," XX Nothing promised here [%.30s] (%u/%u minutes
> elapsed)\n",cflock,elapsedtime,attr.transaction.ifelapsed);
>    return this;
>    }
> 
> In the debugger:
> 
> (dbx) stop in AcquireLock
> [1] stop in AcquireLock
> (dbx) run
> [1] stopped in AcquireLock at line 59 in file "transaction.c" ($t1)
>    59     int i, err, sum=0;
> (dbx) p attr.transaction.ifelapsed
> 538233276
> (dbx) p attr.transaction.expireafter
> -801911168
> 
> 
> The proposed change I have is to zero-out dummyattr in StartServer:
> 
> void StartServer(int argc,char **argv)
> 
> { char ipaddr[CF_MAXVARSIZE],intime[64];
>   int sd,sd_reply;
>   fd_set rset;
>   time_t now;
>   struct timeval timeout;
>   int ret_val;
>   struct Promise *pp = NewPromise("server_cfengine","the server daemon");
>   struct Attributes dummyattr;
>   struct CfLock thislock;
> 
>   /* initialize dummyattr */;
>   memset(&dummyattr,0,sizeof(dummyattr));
> 
> 
> In the debugger after the memset:
> 
> (dbx) stop in AcquireLock
> [1] stop in AcquireLock
> (dbx) run
> [1] stopped in AcquireLock at line 59 in file "transaction.c" ($t1)
>    59     int i, err, sum=0;
> (dbx) p attr.transaction.ifelapsed
> 0
> (dbx) p attr.transaction.expireafter
> 0
> 
> 
> Yay, pretty.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Bug-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/bug-cfengine

-- 
Mark Burgess

-------------------------------------------------
Professor of Network and System Administration
Oslo University College, Norway

Personal Web: http://www.iu.hio.no/~mark
Office Telf : +47 22453272
-------------------------------------------------
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to