about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/mkdir.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/mkdir.c')
-rw-r--r--sysdeps/mach/hurd/mkdir.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/mkdir.c b/sysdeps/mach/hurd/mkdir.c
index d3627ee5e1..8ad648e0a3 100644
--- a/sysdeps/mach/hurd/mkdir.c
+++ b/sysdeps/mach/hurd/mkdir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,93,94,95,96,97,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,6 +19,7 @@
 #include <stddef.h>
 #include <sys/stat.h>
 #include <hurd.h>
+#include <string.h>
 
 /* Create a directory named FILE_NAME with protections MODE.  */
 int
@@ -28,7 +29,10 @@ __mkdir (file_name, mode)
 {
   error_t err;
   const char *name;
-  file_t parent = __directory_name_split (file_name, (char **) &name);
+  file_t parent;
+  if (!strcmp (file_name, "/"))
+    return __hurd_fail (EEXIST);
+  parent = __directory_name_split (file_name, (char **) &name);
   if (parent == MACH_PORT_NULL)
     return -1;
   err = __dir_mkdir (parent, name, mode & ~_hurd_umask);