26 May
2005
26 May
'05
4:20 a.m.
Dmitry Timoshkov wrote:
"Steven Edwards" <steven_ed4153(a)yahoo.com> wrote:
+int sys_mkdir(const char *path, mode_t mode) +{ +#ifdef HAVE_MKDIR_MODE + return mkdir(path, mode); +#else + return mkdir(path); +#endif +}
Wouldn't it be better to emulate
mkdir(path, mode);
with
mkdir(path); chmod(path, mode);
No, that's introducing a race between the directory creation and the mode setting. Also, the first form takes umask into consideration, which the second doesn't. Shachar -- Shachar Shemesh Lingnu Open Source Consulting ltd. http://www.lingnu.com/