mkstemp, libinn and other

Russ Allbery rra at stanford.edu
Tue Mar 28 23:14:27 UTC 2000


Matus \"fantomas\" Uhlar <uhlar at fantomas.sk> writes:

> defining USE_PARSEDATE wil cause newsgate to use libinn's parsedate
> routine.  I tried to #include <libinn.h> to have function prototype.

> gcc -g -O2 -Wall -DUSE_PARSEDATE -DHAVE_MKSTEMP
> -I/home/news/inn-2.2.2/include -
> In file included from /home/news/inn-2.2.2/include/libinn.h:8,
>                  from rfc822.c:6:
> /home/news/inn-2.2.2/include/storage.h:25: syntax error before `OFFSET_T'
> /home/news/inn-2.2.2/include/storage.h:60: syntax error before `IsToken'
> /home/news/inn-2.2.2/include/storage.h:60: warning: type defaults to `int' in declaration of `IsToken'

> ehm, seems that either libinn.h should include clibrary.h ot I should do
> it in rfc822.c; anyway I don't think i should do that...

This has been fixed in INN 2.3.  Those definitions have been moved to
config.h, which is included by storage.h.

> mkstemp (appears in FreeBSD4.0 and seems it appeared since FreeBSD
> exists) takes filename mask and returns opened file descriptor. quite
> easy in some of programs but quite hard in library functions they
> probably need rewrite to use mkstemp...

> There's also function TempName which seems to be useless when mkstemp() is
> used.

> many functions in libinn use mktemp and pass the result to another one
> function. Maybe i should rewrite those functions, if they will get empty
> filename, whey will generate temporary file...  any ideas, suggestions,
> comments ?

I'd love to see the entire temporary file handling just redone completely.
If you feel like tackling that, I'd encourage you not to work to minimize
the scope of the change; feel free to rip out all current calls to
TempName() and any other mechanism for creating temporary files, replace
them all with calls to mkstemp(), and provide a replacement mkstemp() if
the function can't be found.

The only thing you shouldn't change is the interface to the public
functions in libinn (the ones without underscores that are documented in
the older man pages), as some other programs use those functions and would
break if their interface has changed.

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>



More information about the inn-workers mailing list