#include <common.h>
#include <log/log.h>
+#include <system/signals.h>
#include <types/Policy.h>
#include <types/PolicyBucketId.h>
#include <types/PolicyKey.h>
init_log();
+ ignore_sigpipe();
+
LOGD("Cynara admin initialized");
return CYNARA_ADMIN_API_SUCCESS;
#include <common.h>
#include <log/log.h>
+#include <system/signals.h>
#include <cynara-client.h>
#include <api/ApiInterface.h>
}
init_log();
+
+ ignore_sigpipe();
+
LOGD("Cynara client initialized");
return cynara_api_result::CYNARA_API_SUCCESS;
${COMMON_PATH}/response/ResponseTaker.cpp
${COMMON_PATH}/sockets/Socket.cpp
${COMMON_PATH}/sockets/SocketClient.cpp
+ ${COMMON_PATH}/system/signals.cpp
${COMMON_PATH}/types/PolicyBucket.cpp
${COMMON_PATH}/types/PolicyKey.cpp
)
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
+ *
+ * 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
+ *
+ * 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.
+ */
+/*
+ * @file signals.cpp
+ * @author Adam Malinowski <a.malinowsk2@partner.samsung.com>
+ * @version 1.0
+ * @brief Implementation of signal related functions
+ */
+
+#include <signal.h>
+#include <string.h>
+
+#include <log/log.h>
+
+#include "signals.h"
+
+void ignore_sigpipe(void)
+{
+ struct sigaction act;
+
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = SIG_IGN;
+
+ if (sigaction(SIGPIPE, &act, NULL))
+ LOGE("sigaction failed during setting SIGPIPE handler to ignore");
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
+ *
+ * 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
+ *
+ * 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.
+ */
+/*
+ * @file signals.h
+ * @author Adam Malinowski <a.malinowsk2@partner.samsung.com>
+ * @version 1.0
+ * @brief Declaration of signal related functions
+ */
+
+#ifndef SRC_COMMON_SYSTEM_SIGNALS_H_
+#define SRC_COMMON_SYSTEM_SIGNALS_H_
+
+void ignore_sigpipe(void);
+
+#endif /* SRC_COMMON_SYSTEM_SIGNALS_H_ */