~ubuntu-branches/ubuntu/precise/eglibc/precise

« back to all changes in this revision

Viewing changes to debian/patches/hurd-i386/tg-mkdir_root.diff

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2011-10-04 17:48:26 UTC
  • mfrom: (216.1.23 oneiric)
  • Revision ID: package-import@ubuntu.com-20111004174826-2cyb9ewn3ucymlsx
Tags: 2.13-20ubuntu5
libc6-dev: Don't break the current {gnat,gcj}-4.4-base versons. LP: #853688.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
2
 
Subject: [PATCH] Fix mkdir / error value
3
 
 
4
 
(needed for busybox's mkdir -p)
5
 
 
6
 
In the / case, directory_name_split can't really split that into an
7
 
absolute ROOT file_t and ".", since name is supposed to be a pointer in
8
 
file_name... Changing the interface is being proposed.
9
 
 
10
 
---
11
 
 sysdeps/mach/hurd/mkdir.c   |    6 +++++-
12
 
 sysdeps/mach/hurd/mkdirat.c |    6 +++++-
13
 
 2 files changed, 10 insertions(+), 2 deletions(-)
14
 
 
15
 
diff --git a/sysdeps/mach/hurd/mkdir.c b/sysdeps/mach/hurd/mkdir.c
16
 
index b7e8074..cf6dda3 100644
17
 
--- a/sysdeps/mach/hurd/mkdir.c
18
 
+++ b/sysdeps/mach/hurd/mkdir.c
19
 
@@ -20,6 +20,7 @@
20
 
 #include <stddef.h>
21
 
 #include <sys/stat.h>
22
 
 #include <hurd.h>
23
 
+#include <string.h>
24
 
 
25
 
 /* Create a directory named FILE_NAME with protections MODE.  */
26
 
 int
27
 
@@ -29,7 +30,10 @@ __mkdir (file_name, mode)
28
 
 {
29
 
   error_t err;
30
 
   const char *name;
31
 
-  file_t parent = __directory_name_split (file_name, (char **) &name);
32
 
+  file_t parent;
33
 
+  if (!strcmp(file_name, "/"))
34
 
+    return EEXIST;
35
 
+  parent = __directory_name_split (file_name, (char **) &name);
36
 
   if (parent == MACH_PORT_NULL)
37
 
     return -1;
38
 
   err = __dir_mkdir (parent, name, mode & ~_hurd_umask);
39
 
diff --git a/sysdeps/mach/hurd/mkdirat.c b/sysdeps/mach/hurd/mkdirat.c
40
 
index a300745..8256ef8 100644
41
 
--- a/sysdeps/mach/hurd/mkdirat.c
42
 
+++ b/sysdeps/mach/hurd/mkdirat.c
43
 
@@ -23,6 +23,7 @@
44
 
 #include <sys/stat.h>
45
 
 #include <hurd.h>
46
 
 #include <hurd/fd.h>
47
 
+#include <string.h>
48
 
 
49
 
 int
50
 
 mkdirat (fd, path, mode)
51
 
@@ -32,7 +33,10 @@ mkdirat (fd, path, mode)
52
 
 {
53
 
   error_t err;
54
 
   const char *name;
55
 
-  file_t parent = __directory_name_split_at (fd, path, (char **) &name);
56
 
+  file_t parent;
57
 
+  if (!strcmp(path, "/"))
58
 
+    return EEXIST;
59
 
+  parent = __directory_name_split_at (fd, path, (char **) &name);
60
 
   if (parent == MACH_PORT_NULL)
61
 
     return -1;
62
 
   err = __dir_mkdir (parent, name, mode & ~_hurd_umask);
63
 
tg: (0234227..) t/mkdir_root (depends on: baseline)