- serverSessionRef mySession = getSession(server);
- SCDSessionPrivateRef sessionPrivate = (SCDSessionPrivateRef)mySession->session;
-
- SCDLog(LOG_DEBUG, CFSTR("Send mach message when a notification key changes."));
- SCDLog(LOG_DEBUG, CFSTR(" server = %d"), server);
- SCDLog(LOG_DEBUG, CFSTR(" port = %d"), port);
- SCDLog(LOG_DEBUG, CFSTR(" message id = %d"), identifier);
-
- if (sessionPrivate->notifyPort != MACH_PORT_NULL) {
- SCDLog(LOG_DEBUG, CFSTR(" destroying old callback mach port %d"), sessionPrivate->notifyPort);
- (void) mach_port_destroy(mach_task_self(), sessionPrivate->notifyPort);
+ serverSessionRef mySession = getSession(server);
+ SCDynamicStorePrivateRef storePrivate;
+
+ if (mySession == NULL) {
+ /* sorry, you must have an open session to play */
+ *sc_status = kSCStatusNoStoreSession;
+ if (port != MACH_PORT_NULL) {
+ (void) mach_port_deallocate(mach_task_self(), port);
+ }
+ return KERN_SUCCESS;