/[inetutils]/inetutils/m4/getcwd-path-max.m4
ViewVC logotype

Diff of /inetutils/m4/getcwd-path-max.m4

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by ams, Fri Jan 21 13:02:48 2005 UTC revision 1.2 by gray, Fri Jul 29 10:52:44 2005 UTC
# Line 1  Line 1 
1  #serial 6  #serial 9
2  # Check for several getcwd bugs with long paths.  # Check for several getcwd bugs with long file names.
3  # If so, arrange to compile the wrapper function.  # If so, arrange to compile the wrapper function.
4    
5  # This is necessary for at least GNU libc on linux-2.4.19 and 2.4.20.  # This is necessary for at least GNU libc on linux-2.4.19 and 2.4.20.
6  # I've heard that this is due to a Linux kernel bug, and that it has  # I've heard that this is due to a Linux kernel bug, and that it has
7  # been fixed between 2.4.21-pre3 and 2.4.21-pre4.  */  # been fixed between 2.4.21-pre3 and 2.4.21-pre4.  */
8    
9  # Copyright (C) 2003, 2004 Free Software Foundation, Inc.  # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
10    # This file is free software; the Free Software Foundation
11  # This program is free software; you can redistribute it and/or modify  # gives unlimited permission to copy and/or distribute it,
12  # it under the terms of the GNU General Public License as published by  # with or without modifications, as long as this notice is preserved.
 # the Free Software Foundation; either version 2, or (at your option)  
 # any later version.  
   
 # This program is distributed in the hope that it will be useful,  
 # but WITHOUT ANY WARRANTY; without even the implied warranty of  
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
 # GNU General Public License for more details.  
   
 # You should have received a copy of the GNU General Public License  
 # along with this program; if not, write to the Free Software Foundation,  
 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
13    
14  # From Jim Meyering  # From Jim Meyering
15    
# Line 109  main (void) Line 98  main (void)
98        char *c = NULL;        char *c = NULL;
99    
100        cwd_len += DIR_NAME_SIZE;        cwd_len += DIR_NAME_SIZE;
101        /* If mkdir or chdir fails, be pessimistic and consider that        /* If mkdir or chdir fails, it could be that this system cannot create
102           as a failure, too.  */           any file with an absolute name longer than PATH_MAX, such as cygwin.
103             If so, leave fail as 0, because the current working directory can't
104             be too long for getcwd if it can't even be created.  For other
105             errors, be pessimistic and consider that as a failure, too.  */
106        if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0)        if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0)
107          {          {
108            fail = 2;            if (! (errno == ERANGE || is_ENAMETOOLONG (errno)))
109                fail = 2;
110            break;            break;
111          }          }
112    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26