This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix allocation limit for getcwd syscall


The actual filename limit of the getcwd syscall is PAGE_SIZE.  If we don't
allocate a buffer big enough we get an assertion failure when $PWD is
longer than PATH_MAX.

Andreas.

2005-11-04  Andreas Schwab  <schwab@suse.de>

	* sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Increase default
	allocation size to one page.

--- sysdeps/unix/sysv/linux/getcwd.c.~1.22.~	2003-09-22 22:58:00.000000000 +0200
+++ sysdeps/unix/sysv/linux/getcwd.c	2005-10-01 23:41:53.000000000 +0200
@@ -86,7 +86,7 @@ __getcwd (char *buf, size_t size)
 	  return NULL;
 	}
 
-      alloc_size = PATH_MAX;
+      alloc_size = __getpagesize ();
     }
 
   if (buf == NULL)

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]