diff --git a/lisp/elf.c b/lisp/elf.c
index d0ac636b5d7fd525cd8bcbcba2436d78a360fdd2..0818bdd42bb1bba768ae89335d5f62981784f474 100644
--- a/lisp/elf.c
+++ b/lisp/elf.c
@@ -8,7 +8,7 @@
 
  Above changes put into main CVS branch. 05-Jul-2007.
 
- $Id: elf.c,v 1.15 2007/12/14 09:09:50 cshapiro Exp $
+ $Id: elf.c,v 1.16 2008/03/18 08:47:48 cshapiro Exp $
 */
 
 #include <stdio.h>
@@ -96,12 +96,12 @@ elseek(int d, off_t o, const char *func)
 static int
 create_elf_file (const char *dir, int id)
 {
-    char outfilename[MAXPATHLEN + 1];
+    char outfilename[FILENAME_MAX + 1];
     int out;
 
     /* Note: the space id will be either 1, 2 or 3.  Subtract one to index
        the name array. */
-    snprintf(outfilename, MAXPATHLEN, "%s/%s.o", dir, section_names[id - 1]);
+    snprintf(outfilename, FILENAME_MAX, "%s/%s.o", dir, section_names[id - 1]);
     out = open(outfilename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
 
     if(!out) {
@@ -313,7 +313,7 @@ write_elf_object(const char *dir, int id, os_vm_address_t start, os_vm_address_t
 void
 elf_cleanup(const char *dirname)
 {
-    char filename[MAXPATHLEN];
+    char filename[FILENAME_MAX + 1];
     int i;
 
     /* Get rid of lisp space files. */
@@ -331,8 +331,8 @@ elf_run_linker(long init_func_address, char *file)
     lispobj libstring = SymbolValue(CMUCL_LIB);     /* Get library: */
     struct vector *vec = (struct vector *)PTR(libstring);
     char *paths = strdup((char *)vec->data);
-    char command[MAXPATHLEN + 1];
-    char command_line[MAXPATHLEN + MAXPATHLEN + 10];
+    char command[FILENAME_MAX + 1];
+    char command_line[FILENAME_MAX + FILENAME_MAX + 10];
     char *strptr;
     struct stat st;
     int ret;
diff --git a/lisp/lisp.c b/lisp/lisp.c
index 9d743191f4bfa60ac8f46c81abd299f835bf79e7..32c6d00ff925afd4a4ec6a63ac9e739b1b2a7a80 100644
--- a/lisp/lisp.c
+++ b/lisp/lisp.c
@@ -1,7 +1,7 @@
 /*
  * main() entry point for a stand alone lisp image.
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.60 2007/07/25 10:23:54 cshapiro Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.61 2008/03/18 08:47:48 cshapiro Exp $
  *
  */
 
@@ -152,8 +152,8 @@ default_cmucllib(char *argv0arg)
 	 * argv[0] is a relative path.  Get the current directory and
 	 * append argv[0], after stripping off the executable name.
 	 */
-	cwd = malloc(MAXPATHLEN + strlen(argv0_dir) + 100);
-	getcwd(cwd, MAXPATHLEN);
+	cwd = malloc(FILENAME_MAX + strlen(argv0_dir) + 100);
+	getcwd(cwd, FILENAME_MAX);
 	strcat(cwd, "/");
 	if (*argv0_dir != '\0') {
 	    strcat(cwd, argv0_dir);
@@ -175,7 +175,7 @@ default_cmucllib(char *argv0arg)
 	    fprintf(stderr, "User's PATH = %s\n", path ? path : "<NULL>");
 	}
 
-	cwd = malloc(MAXPATHLEN + strlen(argv0arg) + 100);
+	cwd = malloc(FILENAME_MAX + strlen(argv0arg) + 100);
 	cwd[0] = '\0';
 
 	if (path) {
@@ -343,7 +343,7 @@ search_core(const char *lib, const char *default_core)
 char *
 prepend_core_path(char *lib, char *corefile)
 {
-    char cwd[MAXPATHLEN];
+    char cwd[FILENAME_MAX];
     char *path;
     char *result;
     char *sep;
@@ -355,8 +355,8 @@ prepend_core_path(char *lib, char *corefile)
 	 * We have a relative path for the corefile.  Prepend our current
 	 * directory to get the full path.
 	 */
-	getcwd(cwd, MAXPATHLEN);
-	path = malloc(MAXPATHLEN + strlen(corefile) + 2);
+	getcwd(cwd, FILENAME_MAX);
+	path = malloc(FILENAME_MAX + strlen(corefile) + 2);
 	strcpy(path, cwd);
 	strcat(path, "/");
 	strcat(path, corefile);