warnings on compile

Anders C. Thorsen anders at aae.wisc.edu
Thu Dec 14 16:15:08 GMT 2000


On Fri, Dec 15, 2000 at 11:44:20AM +0900, Kenichi Okuyama wrote:
> >>>>> "TP" == Tim Potter <tpot at linuxcare.com.au> writes:
> TP> Well the warning is technically right - mktmp() may *possibly* be
> TP> used unsafely but it isn't in this case.  (-:
> TP> It's a pretty annoying error though.  I wonder if it's possible
> TP> to patch gcc to determine whether the O_EXCL flag is not being
> TP> used and then print out the warning rather than always doing it.
> 
> How can you possibly do such thing when you don't even know whether
> the passed string WILL EVEN BE USED AS FILENAME?
> 
> I think we should rather create mktemp() and mkstemp() of our own,
> without using mktemp() of library. As far as I know, what we really
> need is mkstemp() with filename not having ':', and because we can
> see the glibc codes, I think we can do this.
> 
> I don't think we really need mktemp() at all.
> # Do we really/truely? Where??

Why bother. Do we really/truely need printf(). We could always create
our own samba edt. of libc, right?

I always get a bit upset when people suggests to make their own implementations
of something which make perfect sense to use. A mktemp() for samba
would do the same thing, and would have the same (potential) problems.

Oh well.. As long as mktemp() is used safely, why not continue to
do so.
If we want people to realize that it is safe, then add
something like:


#ifdef ANNOYING_GCC_VER
#warning "the gcc compiler will complain about mktemp() beeing broken/unsecure"
#warning "samba make use of this function in a safe manner, please ignore the warning"
#warning "you might want to have a look at the samba FAQ www.samba.org"
#endif

-- 

--Anders

Anders C. Thorsen
PGP Key: http://www.aae.wisc.edu/~anders/anders-pgp.asc

----------------------------------------
Only two things are infinite.
The universe and human stupidity.
Although, I am unsure of the former.

Albert Einstein





More information about the samba-technical mailing list