Possible bug in random name generation for mkostemp and friends

Michael Deutschmann michael at talamasca.ocis.net
Sat Feb 2 22:26:10 UTC 2013


On Sat, 2 Feb 2013, "Anthony G. Basile" wrote:
> Even though 'value' is declared static it is never initialized.  Isn't
> this a problem?

In C, statics are implicitly initialized to all-bits-zero.

While I only know this offhand to be standards-required for static data
declared at toplevel, there's no way under the Unix assembler/linker
paradigm to specify that a non-stack variable is truly uninitialized.

Adding a '= 0;' might be a style recommendation.  However, in past people
often avoided that due to lazy compilers that would then put the object in
the data section, wasting space in the final executable file.

I also understand at one point GCC was deliberately so stupid in order to
accomodate a common hack to do what, today, we do with the "_edata"
linker-generated symbol.  Current GCC seems to be smart, though.

---- Michael Deutschmann <michael at talamasca.ocis.net>


More information about the uClibc mailing list