Nothing says that /var/log can't be not a directory but a symbolic link

to a directory. Therefore, use stat(2) instead of lstat(2) to check if
/var/log exists.

MFC after:	7 days
This commit is contained in:
Maxim Sobolev 2004-07-04 17:24:12 +00:00
parent 15a66c21c0
commit ea6902220d

View File

@ -2247,9 +2247,9 @@ createlog(const struct conf_entry *ent)
slash = strrchr(tempfile, '/');
if (slash != NULL) {
*slash = '\0';
failed = lstat(tempfile, &st);
failed = stat(tempfile, &st);
if (failed && errno != ENOENT)
err(1, "Error on lstat(%s)", tempfile);
err(1, "Error on stat(%s)", tempfile);
if (failed)
createdir(ent, tempfile);
else if (!S_ISDIR(st.st_mode))