linux-lts-quantal-3.5.0/kernel/replay.c
// Checks to see if matching libpath is present in arg/env buffer - returns 0 if true, index if no match, -1 if not present
Checks to see if matching libpath is present in arg/env buffer - returns 0 if true, index if no match, -1 if not present
Checks to see if matching libpath is present in arg / env buffer - returns 0 if true index if no match - 1 if not present
static int
is_libpath_present (struct record_group* prg, char* p)
{
	int cnt, i, len;
	cnt = *((int *) p);
	p += sizeof(int);
	for (i = 0; i < cnt; i++) {
		len = *((int *) p);
		p += sizeof(int) + len;
	}
	cnt = *((int *) p);
	p += sizeof(int);
	for (i = 0; i < cnt; i++) {
		len = *((int *) p);
		if (strncmp(p+sizeof(int), "LD_LIBRARY_PATH=", 16) == 0) {
			DPRINT ("pid %d: libpath is %s\n", current->pid, (char *)(p+sizeof(int)));
			if (strcmp(p+sizeof(int), prg->rg_libpath) == 0) {
				DPRINT ("pid %d: libpath matches\n", current->pid);
				return 0; 
			}
			DPRINT ("pid %d: libpath does not match %d %d, return %d\n", current->pid, strlen(prg->rg_libpath)+1, len, i);
			return i; 
		}
		p += sizeof(int) + len;
	}
	DPRINT ("pid %d: libpath not found\n", current->pid);
	return -1; 
}
static int is_libpath_present ( struct record_group * prg , char * p ) { int cnt , i , len ; cnt = * ( ( int * ) p ) ; p += sizeof ( int ) ; for ( i = 0 ; i < cnt ; i ++ ) { len = * ( ( int * ) p ) ; p += sizeof ( int ) + len ; } cnt = * ( ( int * ) p ) ; p += sizeof ( int ) ; for ( i = 0 ; i < cnt ; i ++ ) { len = * ( ( int * ) p ) ; if ( strncmp ( p + sizeof ( int ) , " " , 16 ) == 0 ) { DPRINT ( " \n " , current -> pid , ( char * ) ( p + sizeof ( int ) ) ) ; if ( strcmp ( p + sizeof ( int ) , prg -> rg_libpath ) == 0 ) { DPRINT ( " \n " , current -> pid ) ; return 0 ; } DPRINT ( " \n " , current -> pid , strlen ( prg -> rg_libpath ) + 1 , len , i ) ; return i ; } p += sizeof ( int ) + len ; } DPRINT ( " \n " , current -> pid ) ; return -1 ; }
Checks to see if matching libpath is present in arg/env buffer - returns 0 if true, index if no match, -1 if not present
Checks to see if matching libpath is present in arg / env buffer - returns 0 if true index if no match - 1 if not present
// Skip args // match found // libarary path there at this index but does not match // library path not there at all