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

« back to all changes in this revision

Viewing changes to debian/patches/hurd-i386/tg-null-pathname.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] null pathnames shall return ENOENT
3
 
 
4
 
Here is a patch to fix chdir("") and chroot("") into returning ENOENT as
5
 
required by POSIX.
6
 
 
7
 
2009-09-13  Samuel Thibault  <samuel.thibault@ens-lyon.org>
8
 
 
9
 
        * hurd/hurdchdir.c (_hurd_change_directory_port_from_name):
10
 
        Return ENOENT when name is empty.
11
 
        * sysdeps/mach/hurd/chroot.c (chroot): Return ENOENT when path
12
 
        is empty.
13
 
 
14
 
---
15
 
http://sources.redhat.com/ml/libc-alpha/2009-09/msg00025.html
16
 
 
17
 
 hurd/hurdchdir.c           |    6 ++++++
18
 
 sysdeps/mach/hurd/chroot.c |    6 ++++++
19
 
 2 files changed, 12 insertions(+), 0 deletions(-)
20
 
 
21
 
diff --git a/hurd/hurdchdir.c b/hurd/hurdchdir.c
22
 
index 5115e4d..b1cc7a5 100644
23
 
--- a/hurd/hurdchdir.c
24
 
+++ b/hurd/hurdchdir.c
25
 
@@ -38,6 +38,12 @@ _hurd_change_directory_port_from_name (struct hurd_port *portcell,
26
 
   len = strlen (name);
27
 
   if (len >= 2 && name[len - 2] == '/' && name[len - 1] == '.')
28
 
     lookup = name;
29
 
+  else if (len == 0)
30
 
+    {
31
 
+      /* Special-case null pathname according to POSIX */
32
 
+      errno = ENOENT;
33
 
+      return -1;
34
 
+    }
35
 
   else
36
 
     {
37
 
       char *n = alloca (len + 3);
38
 
diff --git a/sysdeps/mach/hurd/chroot.c b/sysdeps/mach/hurd/chroot.c
39
 
index fde0164..cabeb7d 100644
40
 
--- a/sysdeps/mach/hurd/chroot.c
41
 
+++ b/sysdeps/mach/hurd/chroot.c
42
 
@@ -38,6 +38,12 @@ chroot (const char *path)
43
 
   len = strlen (path);
44
 
   if (len >= 2 && path[len - 2] == '/' && path[len - 1] == '.')
45
 
     lookup = path;
46
 
+  else if (len == 0)
47
 
+    {
48
 
+      /* Special-case null pathname according to POSIX */
49
 
+      errno = ENOENT;
50
 
+      return -1;
51
 
+    }
52
 
   else
53
 
     {
54
 
       char *n = alloca (len + 3);
55
 
tg: (0234227..) t/null-pathname (depends on: baseline)