|
From: Patrick M. <ume...@us...> - 2008-07-31 20:54:04
|
Update of /cvsroot/radmind/radmind In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv3057 Modified Files: fsdiff.c Log Message: Reordered path_prefix cleanup code to better deal with relative paths. Index: fsdiff.c =================================================================== RCS file: /cvsroot/radmind/radmind/fsdiff.c,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** fsdiff.c 30 Jul 2008 19:56:54 -0000 1.81 --- fsdiff.c 31 Jul 2008 20:54:00 -0000 1.82 *************** *** 357,377 **** len = strlen( path_prefix ); - /* Determine if called with relative or absolute pathing. Path is relative - * if it's just '.' or starts with './'. File names that start with a '.' - * are absolute. - */ - if ( path_prefix[ 0 ] == '.' ) { - if ( len == 1 ) { - tran_format = T_RELATIVE; - } else if ( path_prefix[ 1 ] == '/' ) { - tran_format = T_RELATIVE; - } - } else { - tran_format = T_ABSOLUTE; - } - /* Clip trailing '/' */ if (( len > 1 ) && ( path_prefix[ len - 1 ] == '/' )) { ! path_prefix[ len - 1] = '\0'; } --- 357,364 ---- len = strlen( path_prefix ); /* Clip trailing '/' */ if (( len > 1 ) && ( path_prefix[ len - 1 ] == '/' )) { ! path_prefix[ len - 1 ] = '\0'; ! len--; } *************** *** 385,389 **** case '.': ! if ( path_prefix[ 1 ] == '/' ) { break; } --- 372,377 ---- case '.': ! /* Don't rewrite '.' or paths starting with './' */ ! if (( len == 1 ) || ( path_prefix[ 1 ] == '/' )) { break; } *************** *** 398,401 **** --- 386,405 ---- } + /* Determine if called with relative or absolute pathing. Path is relative + * if it's just '.' or starts with './'. File names that start with a '.' + * are absolute. + */ + if ( path_prefix[ 0 ] == '.' ) { + if ( len == 1 ) { + tran_format = T_RELATIVE; + } else if ( path_prefix[ 1 ] == '/' ) { + tran_format = T_RELATIVE; + } else { + tran_format = T_ABSOLUTE; + } + } else { + tran_format = T_ABSOLUTE; + } + if ( radstat( path_prefix, &st, &type, &afinfo ) != 0 ) { perror( path_prefix ); |