diff --git a/CHANGELOG b/CHANGELOG index bdedbf5..cdf8ed2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,7 @@ - fix handling of trailing white space in wildcard lookup. - check fqdn of each interface when matching export access list. - fix race when setting task done. +- correct return status from do_mkdir. 4/1/2007 autofs-5.0.1 rc3 ------------------------- diff --git a/daemon/automount.c b/daemon/automount.c index ae61f02..368153a 100644 --- a/daemon/automount.c +++ b/daemon/automount.c @@ -81,27 +81,23 @@ static int do_mkdir(const char *parent, const char *path, mode_t mode) /* If path exists we're done */ status = stat(path, &st); if (status == 0) { - if (!S_ISDIR(st.st_mode)) { + if (!S_ISDIR(st.st_mode)) errno = ENOTDIR; - return 0; - } - return 1; + errno = EEXIST; + return 0; } /* * If we're trying to create a directory within an autofs fs - * of the path is contained in a localy mounted fs go ahead. + * or the path is contained in a localy mounted fs go ahead. */ status = -1; if (*parent) status = statfs(parent, &fs); if ((status != -1 && fs.f_type == AUTOFS_SUPER_MAGIC) || contained_in_local_fs(path)) { - if (mkdir(path, mode) == -1) { - if (errno == EEXIST) - return 1; + if (mkdir(path, mode) == -1) return 0; - } return 1; }