[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 "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 ...
<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> <<a href="mailto:hyc@symas.com">hyc@symas.com
</a>> 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>> Full_Name: Gang Wang<br>> Version: 2.3.20<br>> OS:<br>> URL: <a href="ftp://ftp.openldap.org/incoming/">ftp://ftp.openldap.org/incoming/</a><br>> Submission from: (NULL) (<a href="http://202.108.130.138">
202.108.130.138</a>)<br>><br>><br>> openldap-2.3.20/servers/slapd/daemon.c<br>><br>> There is one declaration in slap_daemon structure:<br>><br>> fd_set sd_actives;<br>><br>> 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> -- Howard Chu<br> Chief Architect, Symas Corp. <a href="http://www.symas.com">http://www.symas.com</a><br> Director, Highland Sun <a href="http://highlandsun.com/hyc">http://highlandsun.com/hyc
</a><br> OpenLDAP Core Team <a href="http://www.openldap.org/project/">http://www.openldap.org/project/</a><br></blockquote></div><br>
------=_Part_1433_15850837.1164961653601--