Ignore:
Timestamp:
Nov 9, 2009, 2:49:27 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
1369978
Parents:
2393825
Message:

2009-11-09 Joel Sherrill <joel.sherrill@…>

  • psxmsgq01/init.c, psxsem01/init.c: Add service to check status returned by POSIX methods which return a pointer which is -1 on error. This eliminated some casts.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/psxsem01/init.c

    r2393825 r96bdacd  
    172172  puts( "Init: sem_open - UNSUCCESSFUL (ENAMETOOLONG)" );
    173173  n_sem1 = sem_open(Get_Too_Long_Name(), O_CREAT, 0777, 1 );
    174   fatal_posix_service_status(
    175     (int) n_sem1, (int) SEM_FAILED, "sem_open error return status");
     174  fatal_posix_service_pointer_minus_one(
     175    n_sem1, "sem_open error return status");
    176176  fatal_posix_service_status(
    177177    errno, ENAMETOOLONG, "sem_open errorno ENAMETOOLONG" );
     
    188188  puts( "Init: sem_open - Create an Existing sem (EEXIST)" );
    189189  n_sem2 = sem_open("sem1", O_CREAT | O_EXCL, 0777, 1);
    190   fatal_posix_service_status(
    191     (int) n_sem2, (int) SEM_FAILED, "sem_open error return status" );
     190  fatal_posix_service_pointer_minus_one(
     191    n_sem2, "sem_open error return status" );
    192192  fatal_posix_service_status( errno, EEXIST,  "sem_open errno EEXIST");
    193193
    194194  puts( "Init: sem_open - Open new sem without create flag (ENOENT)" );
    195195  n_sem2 = sem_open("sem3", O_EXCL, 0777, 1);
    196   fatal_posix_service_status(
    197     (int) n_sem2, (int) SEM_FAILED, "sem_open error return status" );
     196  fatal_posix_service_pointer_minus_one(
     197    n_sem2, "sem_open error return status" );
    198198  fatal_posix_service_status( errno, ENOENT,  "sem_open errno EEXIST");
    199199
     
    219219  puts( "Init: sem_open - Open an existing sem ( same id )" );
    220220  n_sem2 = sem_open("sem1", 0 );
    221   fatal_posix_service_status(
    222     (int) n_sem2, (int) n_sem1, "sem_open error return status" );
     221  assert( n_sem2 == n_sem1 );
    223222
    224223  /*
     
    243242  status = sem_close( n_sem1 );
    244243  fatal_posix_service_status( status, 0, "sem_close semaphore");
    245 
    246244
    247245  /*
Note: See TracChangeset for help on using the changeset viewer.