From: <no...@so...> - 2003-04-03 15:08:52
|
Update of /cvsroot/ijbswa/current In directory sc8-pr-cvs1:/tmp/cvs-serv31689 Modified Files: Tag: v_3_0_branch jcc.c Log Message: No longer rely on non-POSIX.1 extensions of getcwd(). Fixes bug #711001 Index: jcc.c =================================================================== RCS file: /cvsroot/ijbswa/current/Attic/jcc.c,v retrieving revision 1.92.2.8 retrieving revision 1.92.2.9 diff -u -d -r1.92.2.8 -r1.92.2.9 --- jcc.c 31 Mar 2003 13:12:32 -0000 1.92.2.8 +++ jcc.c 3 Apr 2003 15:08:42 -0000 1.92.2.9 @@ -33,6 +33,10 @@ * * Revisions : * $Log$ + * Revision 1.92.2.9 2003/04/03 15:08:42 oes + * No longer rely on non-POSIX.1 extensions of getcwd(). + * Fixes bug #711001 + * * Revision 1.92.2.8 2003/03/31 13:12:32 oes * Replaced setenv() by posix-compliant putenv() * Thanks to Neil McCalden (nmcc AT users.sf.net). @@ -1856,16 +1860,17 @@ #if defined(unix) if ( *configfile != '/' ) { - char *abs_file; + char *abs_file, cwd[1024]; /* make config-filename absolute here */ - if ( !(basedir = getcwd( NULL, 1024 ))) + if ( !(getcwd(cwd, sizeof(cwd)))) { perror("get working dir failed"); exit( 1 ); } - if ( !(abs_file = malloc( strlen( basedir ) + strlen( configfile ) + 5 ))) + if (!(basedir = strdup(cwd)) + || (!(abs_file = malloc( strlen( basedir ) + strlen( configfile ) + 5 )))) { perror("malloc failed"); exit( 1 ); |