Ticket #2206: avoid-PATH_MAX.patch
File avoid-PATH_MAX.patch, 1.1 KB (added by , 14 years ago) |
---|
-
tools/jam/src/pwd.c
old new 2 2 /* Software License, Version 1.0. (See accompanying */ 3 3 /* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ 4 4 5 /* Define _GNU_SOURCE to expose get_current_dir_name() */ 6 #define _GNU_SOURCE 7 5 8 #include "jam.h" 6 9 #include "lists.h" 7 10 #include "newstr.h" … … 24 27 /* The current directory can't change in bjam, so optimize this to cache 25 28 ** the result. 26 29 */ 30 #ifndef __GLIBC__ 27 31 static char pwd_buffer[PATH_MAX]; 32 #endif 28 33 static char * pwd_result = NULL; 29 34 30 35 … … 33 38 { 34 39 if (!pwd_result) 35 40 { 41 #ifdef __GLIBC__ 42 if ((pwd_result = get_current_dir_name()) == NULL) 43 #else 36 44 if (getcwd(pwd_buffer, sizeof(pwd_buffer)) == NULL) 45 #endif 37 46 { 38 47 perror("can not get current directory"); 39 48 return L0; 40 49 } 50 #ifndef __GLIBC__ 41 51 else 42 52 { 43 53 #ifdef NT … … 46 56 pwd_result = newstr(pwd_buffer); 47 57 #endif 48 58 } 59 #endif 49 60 } 50 61 return list_new(L0, pwd_result); 51 62 }