Здравствуйте.
GCC говорит, что
warning: the use of `mktemp' is dangerous, better use `mkstemp'
В мане сказано, что
Never use mktemp(). Some implementations follow 4.3BSD and replace XXXXXX
by the current process ID and a single letter, so that at most 26 differ‐
ent names can be returned. Since on the one hand the names are easy to
guess, and on the other hand there is a race between testing whether the
name exists and opening the file, every use of mktemp() is a security
risk. The race is avoided by mkstemp(3).
Но mkstemp нужен не просто для генерации уникального имени - он тут же открывает файл с таким именем (в то время как мне, например нужна просто генерация для клиентского sockaddr_un.sun_path, то есть файл такой создавать не нужно).
Есть ещё tempnam и tmpnam - но там кругом "never use this function".
Как лучше поступить? :)
Спасибо.