[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tempname.c vs. mingw

From: Paul Eggert
Subject: Re: tempname.c vs. mingw
Date: Thu, 29 Jun 2006 11:05:13 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Eric Blake <address@hidden> writes:

> +# if HAVE_IO_H
> +#  include <io.h>
> +# endif
> +# define mkdir ((int (*)()) _mkdir)
> +#endif

Surely this won't work if ! HAVE_DECL_MKDIR && ! HAVE_IO_H, since
_mkdir will be undefined in that case.  Also, older Unix systems lack
a mkdir declaration, but have mkdir (it may not fit the prototype,
though, so you shouldn't declare it without checking).  Also the
"#define" gives me the heebie-jeebies, since it relies on undefined
behavior (passing the wrong number of arguments to a C function).

How about something like this instead?

# include <io.h>
static int mkdir (char const *name, mode_t mode) { return _mkdir (name); }

Other than that, it looks good to me; thanks.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]