Projects
Browse Source     Search     Timeline     Wiki

Changeset 23556

Show
Ignore:
Timestamp:
2008-03-18 10:46:21 (5 months ago)
Author:
zarzycki@…
Message:

<rdar://problem/5795236> Unix callbacks can delete the underlying connection

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/launchd/src/liblaunch.c

    r23552 r23556  
    167167static void launch_mach_checkin_service(launch_data_t obj, const char *key, void *context); 
    168168 
     169static launch_t in_flight_msg_recv_client; 
    169170static pthread_once_t _lc_once = PTHREAD_ONCE_INIT; 
    170171 
     
    582583launchd_close(launch_t lh, typeof(close) closefunc) 
    583584{ 
     585        if (in_flight_msg_recv_client == lh) { 
     586                in_flight_msg_recv_client = NULL; 
     587        } 
     588 
    584589        if (lh->sendbuf) 
    585590                free(lh->sendbuf); 
     
    10311036                } 
    10321037 
     1038                in_flight_msg_recv_client = lh; 
     1039 
    10331040                cb(rmsg, context); 
     1041 
     1042                /* launchd and only launchd can call launchd_close() as a part of the callback */ 
     1043                if (in_flight_msg_recv_client == NULL) { 
     1044                        r = 0; 
     1045                        break; 
     1046                } 
    10341047 
    10351048                lh->recvlen -= data_offset;