Bug 21823 - MAXPATHLEN usage in [gcc]/fixincludes
Summary: MAXPATHLEN usage in [gcc]/fixincludes
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: build
Depends on:
Blocks: 21824
  Show dependency treegraph
Reported: 2005-05-30 15:09 UTC by Alfred M. Szmidt
Modified: 2005-10-01 19:03 UTC (History)
1 user (show)

See Also:
Host: i686-pc-gnu0.3
Target: i686-pc-gnu0.3
Build: i686-pc-gnu0.3
Known to work:
Known to fail:
Last reconfirmed: 2005-06-19 14:01:30

Don't use arbitrary limits. (703 bytes, patch)
2005-10-01 16:37 UTC, Alfred M. Szmidt
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alfred M. Szmidt 2005-05-30 15:09:03 UTC
The way MAXPATHLEN is used in fixincludes (server.c and fixincl.c) is wrong,
instead of defining a bogus value on platforms that do not have MAXPATHLEN
defined (i.e. GNU) one should try and use getcwd as follows:

  char *dir = getcwd (NULL, 0);

instead of passing a buffer and a size.

This will only work on systems that use the GNU C Library.
Comment 1 Andrew Pinski 2005-06-19 14:01:30 UTC
Comment 2 Alfred M. Szmidt 2005-10-01 16:37:56 UTC
Created attachment 9857 [details]
Don't use arbitrary limits.

The following fixes fixincludes.

2005-09-16  Alfred M. Szmidt  <ams@gnu.org>

	* fixincl.c (quoted_file_exists): Use xmalloc to allocate memory
	for FNAME.
	(create_file): Use xmalloc to allocate memory for FNAME.

	* server.c (server_setup): Use dynamic allocation for BUFF.