void cupsdStopServer(void) { if (!started) return; /* * Stop color management (as needed)... */ cupsdStopColor(); /* * Close all network clients... */ cupsdCloseAllClients(); cupsdStopListening(); cupsdStopBrowsing(); cupsdStopAllNotifiers(); cupsdDeleteAllCerts(); if (Clients) { cupsArrayDelete(Clients); Clients = NULL; } /* * Close the pipe for CGI processes... */ if (CGIPipes[0] >= 0) { cupsdRemoveSelect(CGIPipes[0]); cupsdStatBufDelete(CGIStatusBuffer); close(CGIPipes[1]); CGIPipes[0] = -1; CGIPipes[1] = -1; } /* * Close all log files... */ if (AccessFile != NULL) { cupsFileClose(AccessFile); AccessFile = NULL; } if (ErrorFile != NULL) { cupsFileClose(ErrorFile); ErrorFile = NULL; } if (PageFile != NULL) { cupsFileClose(PageFile); PageFile = NULL; } /* * Delete the default security profile... */ cupsdDestroyProfile(DefaultProfile); DefaultProfile = NULL; /* * Write out any dirty files... */ if (DirtyFiles) cupsdCleanDirty(); started = 0; }
void cupsdStopServer(void) { if (!started) return; /* * Close all network clients and stop all jobs... */ cupsdCloseAllClients(); cupsdStopListening(); cupsdStopPolling(); cupsdStopBrowsing(); cupsdStopAllNotifiers(); cupsdSaveRemoteCache(); cupsdDeleteAllCerts(); if (Clients) { cupsArrayDelete(Clients); Clients = NULL; } /* * Close the pipe for CGI processes... */ if (CGIPipes[0] >= 0) { cupsdRemoveSelect(CGIPipes[0]); cupsdStatBufDelete(CGIStatusBuffer); close(CGIPipes[1]); CGIPipes[0] = -1; CGIPipes[1] = -1; } /* * Close all log files... */ if (AccessFile != NULL) { cupsFileClose(AccessFile); AccessFile = NULL; } if (ErrorFile != NULL) { cupsFileClose(ErrorFile); ErrorFile = NULL; } if (PageFile != NULL) { cupsFileClose(PageFile); PageFile = NULL; } #ifdef HAVE_NOTIFY_POST /* * Send one last notification as the server shuts down. */ cupsdLogMessage(CUPSD_LOG_DEBUG, "notify_post(\"com.apple.printerListChange\") last"); notify_post("com.apple.printerListChange"); #endif /* HAVE_NOTIFY_POST */ started = 0; }