@ -114,7 +114,7 @@ static int map_haystacks(const char* const * h, map_t maps[pOUT])
maps - = 1 ;
maps - = 1 ;
ERROR ( " Failed to map file `%s', rolling back %lu maps. (erp: %p, prev: %p) " , path , d , c , maps ) ;
ERROR ( " Failed to map file `%s', rolling back %lu maps. (erp: %p, prev: %p) " , path , d , c , maps ) ;
while ( d - - > 0 )
while ( d - - > 0 )
if ( ! map_handle_err ( map_free ( * ( - - maps ) ) ) ) WARN ( " Failed to free map at %p (in %lu unwind) " , maps , d ) ;
ifU ( ! map_handle_err ( map_free ( * ( - - maps ) ) ) ) WARN ( " Failed to free map at %p (in %lu unwind) " , maps , d ) ;
return 0 ;
return 0 ;
}
}
d + = 1 ;
d + = 1 ;
@ -151,7 +151,7 @@ inv_args:
TRACE ( " Attempting to map %lu haystacks " , hsn ) ;
TRACE ( " Attempting to map %lu haystacks " , hsn ) ;
if ( ! map_haystacks ( ( const char * * ) ( argv + 1 ) , haystacks ) ) {
if ( ! map_haystacks ( ( const char * * ) ( argv + 1 ) , haystacks ) ) {
// Unmap needle before return.
// Unmap needle before return.
if ( ! map_handle_err ( map_free ( needle ) ) ) WARN ( " Failed to unmap needle before exiting after failed haystack maps " ) ;
ifU ( ! map_handle_err ( map_free ( needle ) ) ) WARN ( " Failed to unmap needle before exiting after failed haystack maps " ) ;
return PROG_RET_MAP_HAYSTACK_FAILED ;
return PROG_RET_MAP_HAYSTACK_FAILED ;
}
}
@ -177,11 +177,11 @@ inv_args:
for ( int i = 0 ; i < ( int ) hsn ; i + + ) {
for ( int i = 0 ; i < ( int ) hsn ; i + + ) {
INFO ( " Unmapping haystack haystack file `%s' (#%d) (map addr %p) " , argv [ i + 1 ] , i + 1 , haystacks + i ) ;
INFO ( " Unmapping haystack haystack file `%s' (#%d) (map addr %p) " , argv [ i + 1 ] , i + 1 , haystacks + i ) ;
if ( ! map_handle_err ( map_free ( haystacks [ i ] ) ) ) m_rval = ! m_rval ? PROG_RET_UNMAP_HAYSTACK_N_FAILED ( i + 1 ) : m_rval ;
ifU ( ! map_handle_err ( map_free ( haystacks [ i ] ) ) ) m_rval = ! m_rval ? PROG_RET_UNMAP_HAYSTACK_N_FAILED ( i + 1 ) : m_rval ;
}
}
TRACE ( " Unmap haystacks ended with main rval: %d " , m_rval ) ;
TRACE ( " Unmap haystacks ended with main rval: %d " , m_rval ) ;
INFO ( " Unmapping needle file `%s' " , * argv ) ;
INFO ( " Unmapping needle file `%s' " , * argv ) ;
if ( ! map_handle_err ( map_free ( needle ) ) ) m_rval = ! m_rval ? PROG_RET_UNMAP_NEEDLE_FAILED : m_rval ;
ifU ( ! map_handle_err ( map_free ( needle ) ) ) m_rval = ! m_rval ? PROG_RET_UNMAP_NEEDLE_FAILED : m_rval ;
TRACE ( " main end: rval %d " , m_rval ) ;
TRACE ( " main end: rval %d " , m_rval ) ;
return m_rval ;
return m_rval ;
}
}