Hi-

I was just fiddling with updating the FreeBSD "port" of nmh from 1.0 to
1.0.1 when I noticed that I get this warning compiling:

    cc -c -DHAVE_CONFIG_H -I.. -I. -I.. -O -pipe m_tmpfil.c
    m_tmpfil.c: In function `m_tmpfil':
    m_tmpfil.c:18: warning: passing arg 1 of `unlink' makes pointer from integer 
without a cast

which caused me to check into it (it's probably happened forever without
my checking into it :-)).  The 'man mkstemp' shows this:


    MKTEMP(3)          FreeBSD Library Functions Manual              MKTEMP(3)

    NAME
         mktemp - make temporary file name (unique)

    SYNOPSIS
         #include <unistd.h>

         char *
         mktemp(char *template)

         int
         mkstemp(char *template)

         char *
         mkdtemp(char *template)

    DESCRIPTION

         The mktemp() function takes the given file name template and
         overwrites a portion of it to create a file name.  This file name
         is unique and suit- able for use by the application.  The
         template may be any file name with some number of `Xs' appended
         to it, for example /tmp/temp.XXXX. The trailing `Xs' are replaced
         with the current process number and/or a unique letter
         combination.  The number of unique file names mktemp() can return
         depends on the number of `Xs' provided; six `Xs' will result in
         mktemp() testing roughly 26 ** 6 combinations.

         The mkstemp() function makes the same replacement to the template
         and creates the template file, mode 0600, returning a file
         descriptor opened for reading and writing.  This avoids the race
         between testing for a file's existence and opening it for use.

Now...unfortunately, it looks like all of the mkstemp() calls either
assume that its return value is the char* filename or neglect to notice
(or use) the fact that mkstemp() is returning an open file descriptor.

Does anyone know if this is the standard mkstemp() definition?  Has anyone
noticed this?  Or have a fix just waiting to be applied?  I can take a
look at it, but I'm not so sure WHEN...I've been in perpetual "deadline
mode" for a while now (and a while longer)...

Thanx,

[EMAIL PROTECTED]

Reply via email to