+// SPDX-License-Identifier: LGPL-2.1-or-later
/*
* This file is part of the PCEPlib, a PCEP protocol library.
*
* Copyright (C) 2020 Volta Networks https://voltanet.io/
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
* Author : Brady Johnson <brady@voltanet.io>
*
*/
#include "config.h"
#endif
+#include <assert.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
/* Read from an empty file should return 0, thus
* session_logic_msg_ready_handler returns -1 */
mode_t oldumask;
- oldumask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH);
+ oldumask = umask(S_IXUSR | S_IXGRP | S_IWOTH | S_IROTH | S_IXOTH);
/* Set umask before anything for security */
umask(0027);
char tmpfile[] = "/tmp/pceplib_XXXXXX";
int fd = mkstemp(tmpfile);
umask(oldumask);
- if (fd == -1){
- CU_ASSERT_TRUE(fd>=0);
+ if (fd == -1) {
+ CU_ASSERT_TRUE(fd >= 0);
return;
}
pcep_session session;
pcep_session_event *socket_event = (pcep_session_event *)queue_dequeue(
session_logic_handle_->session_event_queue);
CU_ASSERT_PTR_NOT_NULL(socket_event);
+ assert(socket_event != NULL);
CU_ASSERT_TRUE(socket_event->socket_closed);
pceplib_free(PCEPLIB_INFRA, socket_event);
socket_event = (pcep_session_event *)queue_dequeue(
session_logic_handle_->session_event_queue);
CU_ASSERT_PTR_NOT_NULL(socket_event);
+ assert(socket_event != NULL);
CU_ASSERT_FALSE(socket_event->socket_closed);
CU_ASSERT_PTR_EQUAL(socket_event->session, &session);
CU_ASSERT_EQUAL(socket_event->expired_timer_id, TIMER_ID_NOT_SET);
destroy_pcep_versioning(versioning);
pceplib_free(PCEPLIB_INFRA, socket_event);
close(fd);
+ unlink(tmpfile);
}
pcep_session_event *socket_event = (pcep_session_event *)queue_dequeue(
session_logic_handle_->session_event_queue);
CU_ASSERT_PTR_NOT_NULL_FATAL(socket_event);
+ assert(socket_event != NULL);
CU_ASSERT_TRUE(socket_event->socket_closed);
CU_ASSERT_PTR_EQUAL(socket_event->session, &session);
CU_ASSERT_EQUAL(socket_event->expired_timer_id, TIMER_ID_NOT_SET);
pcep_session_event *socket_event = (pcep_session_event *)queue_dequeue(
session_logic_handle_->session_event_queue);
CU_ASSERT_PTR_NOT_NULL_FATAL(socket_event);
+ assert(socket_event != NULL);
CU_ASSERT_FALSE(socket_event->socket_closed);
CU_ASSERT_PTR_EQUAL(socket_event->session, &session);
CU_ASSERT_EQUAL(socket_event->expired_timer_id, 42);