Originally Posted by
Structure
Code:
return proc_notice_info( err, entryId, notice );
Code:
proc_notice_info( err, notice->ownerId, notice )
What is the return value of this function ?
This would be the first thing i would check.
For that in all error scenarios it returns NULL, only when it did not experience an error does it return the pointer it was given, anyways I finally tracked down the source of the infinite loop after making liberal use of stderr, I made some modifications realising it could be attempting to read memory beyond the buffer but nope, it just refuses to die, this is the loop:
Code:
n = k = full->block;
while ( size ) {
n = strchr( n, '\n' );
if ( n && *n == 0 ) n = NULL;
if ( n ) {
*n = 0;
size -= (intptr_t)(n - k);
}
else size = 0;
fprintf( stderr, "Size = %d Bytes\n", size );
v = strchr( k, '\t' );
*v = 0;
/* We only care about the name and ppid at the moment */
if ( strcmp( k, "Name:" ) == 0 ) {
strcpy( name->block, v );
got_name = 1;
}
else if ( strcmp( k, "PPid:" ) == 0 ) {
ERRMSG( EXIT_SUCCESS, "Point 15");
sscanf( v, "%d", &(notice->ownerId) );
if ( err ) *err = EXIT_SUCCESS;
got_ppid = 1;
}
*v = '\t';
if ( n ) *n = '\n';
k = n;
++k;
}
Somehow size actually increases, anyone have any ideas on how I can correct that to decrease instead?
Edit: Never mind I got it to die by changing the top to this:
Code:
while ( size > 0 ) {
n = strchr( n, '\n' );
if ( n && *n == 0 ) n = NULL;
if ( n ) *n = 0;
size -= strlen(k) + 1;