summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/mg/dir.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/mg/dir.c b/usr.bin/mg/dir.c
index 56867a57615..fddcf021be8 100644
--- a/usr.bin/mg/dir.c
+++ b/usr.bin/mg/dir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dir.c,v 1.20 2012/11/27 19:46:46 jasper Exp $ */
+/* $OpenBSD: dir.c,v 1.21 2013/05/17 04:59:29 lum Exp $ */
/* This file is in the public domain. */
@@ -116,7 +116,11 @@ makedir(int f, int n)
*slash = '\0';
ishere = !stat(path, &sb);
- if (!finished && ishere && S_ISDIR(sb.st_mode)) {
+ if (finished && ishere) {
+ ewprintf("Cannot create directory %s: file exists",
+ path);
+ return(FALSE);
+ } else if (!finished && ishere && S_ISDIR(sb.st_mode)) {
*slash = '/';
continue;
}