-/*
- * Copyright 2001-2009 Internet2
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
*/
/*
- * shar.cpp -- the shibd "main" code. All the functionality is elsewhere
- *
- * Created By: Derek Atkins <derek@ihtfp.com>
- *
- * $Id: shar.cpp 2164 2007-02-11 05:26:18 +0000 (Sun, 11 Feb 2007) cantor $
+ * shibd.cpp -- the shibd "main" code. All the functionality is elsewhere
*/
using namespace std;
bool shibd_shutdown = false;
-const char* shar_config = NULL;
-const char* shar_schemadir = NULL;
-const char* shar_prefix = NULL;
+const char* shar_config = nullptr;
+const char* shar_schemadir = nullptr;
+const char* shar_prefix = nullptr;
bool shar_checkonly = false;
bool shar_version = false;
static bool unlink_socket = false;
-const char* pidfile = NULL;
+const char* pidfile = nullptr;
#ifdef WIN32
sa.sa_handler = SIG_IGN;
sa.sa_flags = SA_RESTART;
- if (sigaction(SIGPIPE, &sa, NULL) < 0) {
+ if (sigaction(SIGPIPE, &sa, nullptr) < 0) {
return -1;
}
sa.sa_handler = term_handler;
sa.sa_flags = SA_RESTART;
- if (sigaction(SIGHUP, &sa, NULL) < 0) {
+ if (sigaction(SIGHUP, &sa, nullptr) < 0) {
return -1;
}
- if (sigaction(SIGINT, &sa, NULL) < 0) {
+ if (sigaction(SIGINT, &sa, nullptr) < 0) {
return -1;
}
- if (sigaction(SIGQUIT, &sa, NULL) < 0) {
+ if (sigaction(SIGQUIT, &sa, nullptr) < 0) {
return -1;
}
- if (sigaction(SIGTERM, &sa, NULL) < 0) {
+ if (sigaction(SIGTERM, &sa, nullptr) < 0) {
return -1;
}
memset(&sa, 0, sizeof (sa));
sa.sa_handler = run_handler;
- if (sigaction(SIGUSR1, &sa, NULL) < 0) {
+ if (sigaction(SIGUSR1, &sa, nullptr) < 0) {
return -1;
}
memset(&sa, 0, sizeof (sa));
sa.sa_handler = child_handler;
- if (sigaction(SIGCHLD, &sa, NULL) < 0) {
+ if (sigaction(SIGCHLD, &sa, nullptr) < 0) {
return -1;
}
}
fprintf(stderr, "listener failure during service\n");
listener->term();
conf.term();
- if (pidfile)
+ if (daemonize && pidfile)
unlink(pidfile);
return -3;
}
}
conf.term();
- if (pidfile)
+ if (daemonize && pidfile)
unlink(pidfile);
return 0;
}