Update of /cvsroot/radmind/radmind-assistant/rsm
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv7502
Modified Files:
rsmauthtool.c
Log Message:
Fix: [ 1532501 ] Cannot delete multiple loadsets in Server Manager.
Loop through args to a_rmloadset to delete all passed-in paths.
Index: rsmauthtool.c
===================================================================
RCS file: /cvsroot/radmind/radmind-assistant/rsm/rsmauthtool.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** rsmauthtool.c 14 Dec 2005 03:38:34 -0000 1.15
--- rsmauthtool.c 1 Aug 2006 15:57:02 -0000 1.16
***************
*** 275,313 ****
a_rmloadset( int ac, char *av[] )
{
- char fpath[ MAXPATHLEN ];
- char *tpath = av[ 0 ];
struct stat st;
! if ( tpath2fpath( tpath, fpath, MAXPATHLEN ) != 0 ) {
! return( 2 );
! }
! if ( lstat( tpath, &st ) != 0 ) {
! fprintf( stderr, "lstat %s: %s\n", tpath, strerror( errno ));
! return( 2 );
! }
!
! if ( S_ISDIR( st.st_mode )) {
! if ( rmdirs( tpath ) != 0 ) {
! fprintf( stderr, "delete %s: %s\n", tpath, strerror( errno ));
return( 2 );
}
! } else {
! if ( unlink( tpath ) < 0 ) {
! fprintf( stderr, "unlink %s: %s\n", tpath, strerror( errno ));
return( 2 );
}
! }
!
! if ( lstat( fpath, &st ) == 0 ) {
if ( S_ISDIR( st.st_mode )) {
! if ( rmdirs( fpath ) != 0 ) {
! fprintf( stderr, "delete %s: %s\n", fpath, strerror( errno ));
return( 2 );
}
}
! } else if ( errno != ENOENT ) {
! fprintf( stderr, "lstat %s: %s\n", fpath, strerror( errno ));
! return( 2 );
}
--- 275,323 ----
a_rmloadset( int ac, char *av[] )
{
struct stat st;
+ char fpath[ MAXPATHLEN ];
+ char *tpath;
+ int i;
! for ( i = 0; i < ac; i++ ) {
! memset( fpath, '\0', MAXPATHLEN );
! tpath = av[ i ];
! if ( tpath2fpath( tpath, fpath, MAXPATHLEN ) != 0 ) {
return( 2 );
}
!
! if ( lstat( tpath, &st ) != 0 ) {
! fprintf( stderr, "lstat %s: %s\n", tpath, strerror( errno ));
return( 2 );
}
!
if ( S_ISDIR( st.st_mode )) {
! if ( rmdirs( tpath ) != 0 ) {
! fprintf( stderr, "delete %s: %s\n", tpath, strerror( errno ));
! return( 2 );
! }
! } else {
! if ( unlink( tpath ) < 0 ) {
! fprintf( stderr, "unlink %s: %s\n", tpath, strerror( errno ));
return( 2 );
}
}
!
! if ( lstat( fpath, &st ) == 0 ) {
! if ( S_ISDIR( st.st_mode )) {
! if ( rmdirs( fpath ) != 0 ) {
! fprintf( stderr, "delete %s: %s\n",
! fpath, strerror( errno ));
! return( 2 );
! }
! } else if ( unlink( fpath ) < 0 ) {
! fprintf( stderr, "unlink %s: %s\n",
! fpath, strerror( errno ));
! }
! } else if ( errno != ENOENT ) {
! fprintf( stderr, "lstat %s: %s\n", fpath, strerror( errno ));
! return( 2 );
! }
}
|