[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#4765) sd_actives in daemon.c not initialized?



------=_Part_1433_15850837.1164961653601
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Yes. but funny that you invoked FD_ZERO() for sd_readers and sd_writers. You
are assuming the semantics of FD_ZERO() is to "set something as zero", but
on some system it is not. For example, implement fd_set as an array, then 0
is a valid value. FD_ZERO() have to initialize something as -1 ...
Funny that the code treat sd_actives differently.

BTW, I know C spec well.

On 12/1/06, Howard Chu <hyc@symas.com> wrote:
>
> wanggang.wang@gmail.com wrote:
> > Full_Name: Gang Wang
> > Version: 2.3.20
> > OS:
> > URL: ftp://ftp.openldap.org/incoming/
> > Submission from: (NULL) (202.108.130.138)
> >
> >
> > openldap-2.3.20/servers/slapd/daemon.c
> >
> > There is one declaration in slap_daemon structure:
> >
> >     fd_set sd_actives;
> >
> > this variable is not initialized ... is this OK with all compilers?
>
> It is a basic part of the C language specification - variables declared
> at file scope are implicitly initialized to zero. Perhaps you need to
> study the language a bit more before trying to do any more work in it.
>
> --
>    -- Howard Chu
>    Chief Architect, Symas Corp.  http://www.symas.com
>    Director, Highland Sun        http://highlandsun.com/hyc
>    OpenLDAP Core Team            http://www.openldap.org/project/
>

------=_Part_1433_15850837.1164961653601
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Yes. but funny that you invoked FD_ZERO() for sd_readers and sd_writers. You are assuming the semantics of FD_ZERO() is to &quot;set something as zero&quot;, but on some system it is not. For example, implement fd_set as an array, then 0 is a valid value. FD_ZERO() have to initialize something as -1 ...
<br>Funny that the code treat sd_actives differently.<br><br>BTW, I know C spec well.<br><br><div><span class="gmail_quote">On 12/1/06, <b class="gmail_sendername">Howard Chu</b> &lt;<a href="mailto:hyc@symas.com";>hyc@symas.com
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><a href="mailto:wanggang.wang@gmail.com";>wanggang.wang@gmail.com</a> wrote:
<br>&gt; Full_Name: Gang Wang<br>&gt; Version: 2.3.20<br>&gt; OS:<br>&gt; URL: <a href="ftp://ftp.openldap.org/incoming/";>ftp://ftp.openldap.org/incoming/</a><br>&gt; Submission from: (NULL) (<a href="http://202.108.130.138";>
202.108.130.138</a>)<br>&gt;<br>&gt;<br>&gt; openldap-2.3.20/servers/slapd/daemon.c<br>&gt;<br>&gt; There is one declaration in slap_daemon structure:<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; fd_set sd_actives;<br>&gt;<br>&gt; this variable is not initialized ... is this OK with all compilers?
<br><br>It is a basic part of the C language specification - variables declared<br>at file scope are implicitly initialized to zero. Perhaps you need to<br>study the language a bit more before trying to do any more work in it.
<br><br>--<br>&nbsp;&nbsp; -- Howard Chu<br>&nbsp;&nbsp; Chief Architect, Symas Corp.&nbsp;&nbsp;<a href="http://www.symas.com";>http://www.symas.com</a><br>&nbsp;&nbsp; Director, Highland Sun&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://highlandsun.com/hyc";>http://highlandsun.com/hyc
</a><br>&nbsp;&nbsp; OpenLDAP Core Team&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.openldap.org/project/";>http://www.openldap.org/project/</a><br></blockquote></div><br>

------=_Part_1433_15850837.1164961653601--