about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/chroot.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-05-13 01:48:25 +0000
committerRoland McGrath <roland@gnu.org>2002-05-13 01:48:25 +0000
commitab7dd85bfbe9a176c2d5055d52185ae6364f97af (patch)
tree6eef4baa61b163061ab60a0ade089984225524c3 /sysdeps/mach/hurd/chroot.c
parent6f1428364a9ef5994087288c21fa4c9222c5fef2 (diff)
downloadglibc-ab7dd85bfbe9a176c2d5055d52185ae6364f97af.tar.gz
glibc-ab7dd85bfbe9a176c2d5055d52185ae6364f97af.tar.xz
glibc-ab7dd85bfbe9a176c2d5055d52185ae6364f97af.zip
2002-05-13 Marcus Brinkmann <marcus@gnu.org>
        * hurd/hurdchdir.c (_hurd_change_directory_port_from_name):
        Allocate three, not two, more than LEN when appending '/.'.
        * sysdeps/mach/hurd/chroot.c (chroot): Likewise.  Don't check
        if NAME ends with '/.' if it is shorter than 2 chars.

	* mach/Makefile ($(mach-syscalls:%=$(objpfx)%.S)): Make the generated
	files #include <sysdep.h> instead of <mach/machine/syscall_sw.h>.
Diffstat (limited to 'sysdeps/mach/hurd/chroot.c')
-rw-r--r--sysdeps/mach/hurd/chroot.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/chroot.c b/sysdeps/mach/hurd/chroot.c
index 83f11bd17e..fde0164713 100644
--- a/sysdeps/mach/hurd/chroot.c
+++ b/sysdeps/mach/hurd/chroot.c
@@ -36,11 +36,11 @@ chroot (const char *path)
   /* Append trailing "/." to directory name to force ENOTDIR if it's not a
      directory and EACCES if we don't have search permission.  */
   len = strlen (path);
-  if (path[len - 2] == '/' && path[len - 1] == '.')
+  if (len >= 2 && path[len - 2] == '/' && path[len - 1] == '.')
     lookup = path;
   else
     {
-      char *n = alloca (len + 2);
+      char *n = alloca (len + 3);
       memcpy (n, path, len);
       n[len] = '/';
       n[len + 1] = '.';