kopia lustrzana https://gitlab.com/sane-project/backends
Fixed segfault condition in sanei_thread_waitpid.
rodzic
75e7483301
commit
fe97c01e62
|
@ -1,6 +1,7 @@
|
||||||
2003-10-10 Gerhard Jaeger <gerhard@gjaeger.de>
|
2003-10-10 Gerhard Jaeger <gerhard@gjaeger.de>
|
||||||
|
|
||||||
* sanei/sanei_thread.c: Fixed some compilation errors on Darwin and OS/2
|
* sanei/sanei_thread.c: Fixed some compilation errors on Darwin and OS/2
|
||||||
|
Fixed segfault condition in sanei_thread_waitpid
|
||||||
|
|
||||||
2003-10-09 Peter Kirchgessner <peter@kirchgessner.net>
|
2003-10-09 Peter Kirchgessner <peter@kirchgessner.net>
|
||||||
|
|
||||||
|
|
|
@ -261,10 +261,9 @@ sanei_thread_waitpid( int pid, int *status )
|
||||||
#else
|
#else
|
||||||
int ls;
|
int ls;
|
||||||
#endif
|
#endif
|
||||||
int result;
|
int result, stat;
|
||||||
|
|
||||||
if (status)
|
stat = 0;
|
||||||
*status = 0;
|
|
||||||
|
|
||||||
DBG(2, "sanei_thread_waitpid() - %d\n", (int)pid);
|
DBG(2, "sanei_thread_waitpid() - %d\n", (int)pid);
|
||||||
#ifdef USE_PTHREAD
|
#ifdef USE_PTHREAD
|
||||||
|
@ -276,26 +275,29 @@ sanei_thread_waitpid( int pid, int *status )
|
||||||
|
|
||||||
if( PTHREAD_CANCELED == ls ) {
|
if( PTHREAD_CANCELED == ls ) {
|
||||||
DBG(2, "* thread has been canceled!\n" );
|
DBG(2, "* thread has been canceled!\n" );
|
||||||
* status = SANE_STATUS_GOOD;
|
stat = SANE_STATUS_GOOD;
|
||||||
} else {
|
} else {
|
||||||
*status = *ls;
|
stat = *ls;
|
||||||
}
|
}
|
||||||
DBG(2, "* result = %d\n", *status );
|
DBG(2, "* result = %d (%p)\n", stat, (void*)status );
|
||||||
}
|
}
|
||||||
|
if (status)
|
||||||
|
*status = stat;
|
||||||
|
|
||||||
/* should return */
|
/* should return pid */
|
||||||
return pid;
|
return pid;
|
||||||
#else
|
#else
|
||||||
result = waitpid( pid, &ls, 0 );
|
result = waitpid( pid, &ls, 0 );
|
||||||
if((result < 0) && (errno == ECHILD)) {
|
if((result < 0) && (errno == ECHILD)) {
|
||||||
if( status )
|
stat = SANE_STATUS_GOOD;
|
||||||
* status = SANE_STATUS_GOOD;
|
|
||||||
result = pid;
|
result = pid;
|
||||||
} else {
|
} else {
|
||||||
if (status) {
|
stat = eval_wp_result( pid, result, ls );
|
||||||
*status = eval_wp_result( pid, result, ls );
|
DBG(2, "* result = %d (%p)\n", stat, (void*)status );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if( status )
|
||||||
|
*status = stat;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue