Menu

#29 incorrect use perror to report error while test pthread func

open
elva fu
Threads (18)
5
2006-10-20
2005-05-12
Ling
No

conformance/interfaces/pthread_attr_setinheritsched/2-
1.c reports
errors incorrectly. pthread functions generally return the
error code
rather than setting errno. The use of perror to report
errors is
hence incorrect:

/* Initialize attr */
rc = pthread_attr_init(&attr);
if( rc != 0) {
perror(ERROR_PREFIX "pthread_attr_init");
exit(PTS_UNRESOLVED);
}

Discussion

  • Ling

    Ling - 2005-05-12
    • assigned_to: rolla --> nobody
     
  • Ling

    Ling - 2005-05-12

    Logged In: YES
    user_id=1150012

    Like conformance/interfaces/pthread_attr_setinheritsched/2-
    1.c, this
    test incorrectly uses perror to report errors. If
    pthread_attr_setstack, the error code is the return value, not
    errno.

     
  • Ling

    Ling - 2006-10-20
    • assigned_to: nobody --> elvafu
     

Log in to post a comment.