about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-29 12:43:18 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-29 12:43:18 -0400
commitd272e7f19dc2dae6d215f6ca6512d042575ed736 (patch)
tree5095f03835f99dac08e08785981f536a020f77ae
parent1bc3307181a2213a4d7253bced376c3de021605e (diff)
downloadglibc-d272e7f19dc2dae6d215f6ca6512d042575ed736.tar.gz
glibc-d272e7f19dc2dae6d215f6ca6512d042575ed736.tar.xz
glibc-d272e7f19dc2dae6d215f6ca6512d042575ed736.zip
Cleanups in ldconfig's chroot handling
-rw-r--r--ChangeLog2
-rw-r--r--elf/chroot_canon.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index fbef6bc6c3..d5d7cb5c74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2011-10-29  Ulrich Drepper  <drepper@gmail.com>
 
+	* elf/chroot_canon.c (chroot_canon): Cleanups.
+
 	* elf/dl-lookup.c (_dl_setup_hash): Avoid warning.
 
 	[BZ #13335]
diff --git a/elf/chroot_canon.c b/elf/chroot_canon.c
index b639cfa82d..f8f3370493 100644
--- a/elf/chroot_canon.c
+++ b/elf/chroot_canon.c
@@ -70,7 +70,6 @@ chroot_canon (const char *chroot, const char *name)
   for (start = end = name; *start; start = end)
     {
       struct stat64 st;
-      int n;
 
       /* Skip sequence of multiple path-separators.  */
       while (*start == '/')
@@ -135,7 +134,7 @@ chroot_canon (const char *chroot, const char *name)
 		  goto error;
 		}
 
-	      n = readlink (rpath, buf, PATH_MAX - 1);
+	      ssize_t n = readlink (rpath, buf, PATH_MAX - 1);
 	      if (n < 0)
 		{
 		  if (*end == '\0')
@@ -148,7 +147,7 @@ chroot_canon (const char *chroot, const char *name)
 		extra_buf = alloca (PATH_MAX);
 
 	      len = strlen (end);
-	      if ((long int) (n + len) >= PATH_MAX)
+	      if (len >= PATH_MAX - n)
 		{
 		  __set_errno (ENAMETOOLONG);
 		  goto error;