From: adilger Date: Tue, 23 Apr 2002 07:15:49 +0000 (+0000) Subject: Return an error from simple_mkdir() if the target exists and isn't a directory. X-Git-Tag: 0.4.2~353 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=3d6fa87d67abc2f501c83590f95fd71f3f8db288;p=fs%2Flustre-release.git Return an error from simple_mkdir() if the target exists and isn't a directory. --- diff --git a/lustre/lib/simple.c b/lustre/lib/simple.c index 366ec68..8876504 100644 --- a/lustre/lib/simple.c +++ b/lustre/lib/simple.c @@ -54,8 +54,12 @@ int simple_mkdir(struct dentry *dir, char *name, int mode) if (IS_ERR(dchild)) RETURN(PTR_ERR(dchild)); - if (dchild->d_inode) + if (dchild->d_inode) { + if (!S_ISDIR(dchild->d_inode->i_mode)) + GOTO(out, err = -ENOTDIR); + GOTO(out, err = -EEXIST); + } err = vfs_mkdir(dir->d_inode, dchild, mode); out: