]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Wrap _exit and exit. Prints error message, and when running under GDB, raises SIGTRA...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 16 Sep 2013 14:44:11 +0000 (15:44 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 20 Sep 2013 18:19:27 +0000 (19:19 +0100)
20 files changed:
src/include/libradius.h
src/lib/event.c
src/lib/fifo.c
src/lib/hash.c
src/lib/heap.c
src/lib/log.c
src/lib/misc.c
src/lib/packet.c
src/lib/rbtree.c
src/lib/udpfromto.c
src/main/conffile.c
src/main/detail.c
src/main/listen.c
src/main/mainconfig.c
src/main/modcall.c
src/main/process.c
src/main/realms.c
src/main/threads.c
src/main/util.c
src/main/valuepair.c

index 843d1aca002a862d94c3b7ecc714924e37e669bd..4f3c0ec8eba72adbe775b797c09abe1f82e65811 100644 (file)
@@ -528,6 +528,15 @@ void               fr_perror(char const *, ...)
                __attribute__ ((format (printf, 1, 2)))
 #endif
 ;
+extern bool fr_assert_cond(char const *file, int line, char const *expr, bool cond);
+#define fr_assert(_x) fr_assert_cond(__FILE__,  __LINE__, #_x, (_x))
+
+extern void _fr_exit(char const *file, int line, int status);
+#define fr_exit(_x) _fr_exit(__FILE__,  __LINE__, (_x))
+
+extern void _fr_exit_now(char const *file, int line, int status);
+#define fr_exit_now(_x) _fr_exit_now(__FILE__,  __LINE__, (_x))
+
 extern char const *fr_strerror(void);
 extern int     fr_dns_lookups; /* 0 = no dns lookups */
 extern int     fr_debug_flag;  /* 0 = no debugging information */
@@ -545,6 +554,7 @@ void                fr_printf_log(char const *, ...)
 /*
  *     Several handy miscellaneous functions.
  */
+void           fr_debug_break(void);
 char const     *ip_ntoa(char *, uint32_t);
 char           *ifid_ntoa(char *buffer, size_t size, uint8_t const *ifid);
 uint8_t                *ifid_aton(char const *ifid_str, uint8_t *ifid);
index e55c78cdd0401e8b3f2df4a59de9a61c07161ee7..a19c84f0b7997dd6f110f7ad64b29619bfe0d2be 100644 (file)
@@ -352,7 +352,7 @@ int fr_event_loop(fr_event_list_t *el)
                        fr_event_t *ev;
 
                        ev = fr_heap_peek(el->times);
-                       if (!ev) _exit(42);
+                       if (!ev) fr_exit_now(42);
 
                        gettimeofday(&el->now, NULL);
 
index 7202a17679e674a135c094c86ae3d7ff06ec1686..b71fc5113bb2c7b58c24e07cf970182df33624d4 100644 (file)
@@ -138,7 +138,7 @@ int main(int argc, char **argv)
        fr_fifo_t *fi;
 
        fi = fr_fifo_create(MAX, NULL);
-       if (!fi) exit(1);
+       if (!fi) fr_exit(1);
 
        for (j = 0; j < 5; j++) {
 #define SPLIT (MAX/3)
@@ -149,20 +149,20 @@ int main(int argc, char **argv)
                        if (!fr_fifo_push(fi, &array[COUNT % MAX])) {
                                fprintf(stderr, "%d %d\tfailed pushing %d\n",
                                        j, i, COUNT);
-                               exit(2);
+                               fr_exit(2);
                        }
 
                        if (fr_fifo_num_elements(fi) != (i + 1)) {
                                fprintf(stderr, "%d %d\tgot size %d expected %d\n",
                                        j, i, i + 1, fr_fifo_num_elements(fi));
-                               exit(1);
+                               fr_exit(1);
                        }
                }
 
                if (fr_fifo_num_elements(fi) != SPLIT) {
                        fprintf(stderr, "HALF %d %d\n",
                                fr_fifo_num_elements(fi), SPLIT);
-                       exit(1);
+                       fr_exit(1);
                }
 
                for (i = 0; i < SPLIT; i++) {
@@ -171,31 +171,31 @@ int main(int argc, char **argv)
                        p = fr_fifo_pop(fi);
                        if (!p) {
                                fprintf(stderr, "No pop at %d\n", i);
-                               exit(3);
+                               fr_exit(3);
                        }
 
                        if (*p != COUNT) {
                                fprintf(stderr, "%d %d\tgot %d expected %d\n",
                                        j, i, *p, COUNT);
-                               exit(4);
+                               fr_exit(4);
                        }
 
                        if (fr_fifo_num_elements(fi) != SPLIT - (i + 1)) {
                                fprintf(stderr, "%d %d\tgot size %d expected %d\n",
                                        j, i, SPLIT - (i + 1), fr_fifo_num_elements(fi));
-                               exit(1);
+                               fr_exit(1);
                        }
                }
 
                if (fr_fifo_num_elements(fi) != 0) {
                        fprintf(stderr, "ZERO %d %d\n",
                                fr_fifo_num_elements(fi), 0);
-                       exit(1);
+                       fr_exit(1);
                }
        }
 
        fr_fifo_free(fi);
 
-       exit(0);
+       fr_exit(0);
 }
 #endif
index 49cf746e1a3cd9e93f5a3c99b5b9699d83364581..a915b56c5278d090f9ea26281b9405a147f5ff18 100644 (file)
@@ -822,11 +822,11 @@ int main(int argc, char **argv)
        ht = fr_hash_table_create(hash_int, NULL, NULL);
        if (!ht) {
                fprintf(stderr, "Hash create failed\n");
-               exit(1);
+               fr_exit(1);
        }
 
        array = malloc(sizeof(int) * MAX);
-       if (!array) exit(1);
+       if (!array) fr_exit(1);
 
        for (i = 0; i < MAX; i++) {
                p = array + i;
@@ -834,13 +834,13 @@ int main(int argc, char **argv)
 
                if (!fr_hash_table_insert(ht, p)) {
                        fprintf(stderr, "Failed insert %08x\n", i);
-                       exit(1);
+                       fr_exit(1);
                }
 #ifdef TEST_INSERT
                q = fr_hash_table_finddata(ht, p);
                if (q != p) {
                        fprintf(stderr, "Bad data %d\n", i);
-                       exit(1);
+                       fr_exit(1);
                }
 #endif
        }
@@ -856,18 +856,18 @@ int main(int argc, char **argv)
                        q = fr_hash_table_finddata(ht, &i);
                        if (!q || *q != i) {
                                fprintf(stderr, "Failed finding %d\n", i);
-                               exit(1);
+                               fr_exit(1);
                        }
 
 #if 0
                        if (!fr_hash_table_delete(ht, &i)) {
                                fprintf(stderr, "Failed deleting %d\n", i);
-                               exit(1);
+                               fr_exit(1);
                        }
                        q = fr_hash_table_finddata(ht, &i);
                        if (q) {
                                fprintf(stderr, "Failed to delete %08x\n", i);
-                               exit(1);
+                               fr_exit(1);
                        }
 #endif
                }
@@ -878,6 +878,6 @@ int main(int argc, char **argv)
        fr_hash_table_free(ht);
        free(array);
 
-       exit(0);
+       fr_exit(0);
 }
 #endif
index ba5b8b5d0fdce58df54a563677bfd2ae3cf0dcfe..2d029b990d4a33d63db6fd780ed361c1b29b509a 100644 (file)
@@ -243,14 +243,14 @@ int main(int argc, char **arg)
        hp = fr_heap_create(heap_cmp, 0);
        if (!hp) {
                fprintf(stderr, "Failed creating heap!\n");
-               exit(1);
+               fr_exit(1);
        }
 
        for (i = 0; i < 1024; i++) {
                array[i] = (i * 257) % 65537;
                if (!fr_heap_insert(hp, &array[i])) {
                        fprintf(stderr, "Failed inserting %d\n", i);
-                       exit(1);
+                       fr_exit(1);
                }
        }
 
@@ -259,14 +259,14 @@ int main(int argc, char **arg)
 
                if (!p) {
                        fprintf(stderr, "Failed peeking %d\n", i);
-                       exit(1);
+                       fr_exit(1);
                }
 
                printf("%d\t%d\n", i, *p);
 
                if (!fr_heap_extract(hp, NULL)) {
                        fprintf(stderr, "Failed extracting %d\n", i);
-                       exit(1);
+                       fr_exit(1);
                }
        }
 
index 488748d2de74f7b4928cf57995bbcf118dc763c5..bfde9ab35b88539a3bd348e3cc20faf985a0dce1 100644 (file)
@@ -142,3 +142,33 @@ void fr_perror(char const *fmt, ...)
        fprintf(stderr, "%s\n", fr_strerror());
        va_end(ap);
 }
+
+bool fr_assert_cond(char const *file, int line, char const *expr, bool cond)
+{
+       if (!cond) {
+               fr_perror("SOFT ASSERT FAILED %s[%u]: %s\n", file, line, expr);
+               return false;
+       }
+
+       return cond;
+}
+
+void NEVER_RETURNS _fr_exit(char const *file, int line, int status)
+{
+       fr_perror("EXIT CALLED %s[%u]: %i\n", file, line, status);
+       fflush(stderr);
+
+       fr_debug_break();       /* If running under GDB we'll break here */
+
+       exit(status);
+}
+
+void NEVER_RETURNS _fr_exit_now(char const *file, int line, int status)
+{
+       fr_perror("_EXIT CALLED %s[%u]: %i\n", file, line, status);
+       fflush(stderr);
+
+       fr_debug_break();       /* If running under GDB we'll break here */
+
+       _exit(status);
+}
index 824e82e24e34508b06c48b8b28311ed6189cb98b..a9cba70f0903a4ec96a9587eda90852fb5be1787 100644 (file)
@@ -27,10 +27,42 @@ RCSID("$Id$")
 #include       <ctype.h>
 #include       <sys/file.h>
 #include       <fcntl.h>
+#include       <signal.h>
 
 int            fr_dns_lookups = 0;
 int            fr_debug_flag = 0;
 
+
+static int     fr_debugger_present = -1;
+
+/** Stub callback to see if the SIGTRAP handler is overriden
+ *
+ * @param signum signal raised.
+ */
+static void _sigtrap_handler(UNUSED int signum)
+{
+    fr_debugger_present = 0;
+    signal(SIGTRAP, SIG_DFL);
+}
+
+/** Break in GDB (if were running under GDB)
+ *
+ * If the server is running under GDB this will raise a SIGTRAP which
+ * will pause the running process.
+ *
+ * If the server is not running under GDB then this will do nothing.
+ */
+void fr_debug_break(void)
+{
+    if (fr_debugger_present == -1) {
+       fr_debugger_present = 0;
+        signal(SIGTRAP, _sigtrap_handler);
+        raise(SIGTRAP);
+    } else if (fr_debugger_present == 1) {
+       raise(SIGTRAP);
+    }
+}
+
 /*
  *     Return an IP address in standard dot notation
  *
index 1127f7ab79ad026a1acd7a7669a3b1a6a86cd83c..732a4e6bcb1d2cad2f369a5a698a86ea5395fd28 100644 (file)
@@ -816,7 +816,7 @@ bool fr_packet_list_id_free(fr_packet_list_t *pl,
 
 #if 0
        if (!ps->id[(request->id >> 3) & 0x1f] & (1 << (request->id & 0x07))) {
-               exit(1);
+               fr_exit(1);
        }
 #endif
 
index fde36515f76803608a94c9a0acff1dc414bc5de9..3562067d4b1f25c142999d03851fb16d4f9b1ca4 100644 (file)
@@ -298,7 +298,7 @@ rbnode_t *rbtree_insertnode(rbtree_t *tree, void *Data)
 
        /* setup new node */
        if ((X = malloc (sizeof(*X))) == NULL) {
-               exit(1);        /* FIXME! */
+               fr_exit(1);     /* FIXME! */
        }
 
        X->Data = Data;
index 59a140867d0be3f71fdccaf23049c6ce63f612a2..66196283c65dfee92d22f29ad050cd4a108fc17b 100644 (file)
@@ -477,13 +477,13 @@ client:
        client_socket = socket(PF_INET, SOCK_DGRAM, 0);
        if (udpfromto_init(client_socket) != 0) {
                perror("udpfromto_init");
-               _exit(0);
+               fr_exit_now(0);
        }
        /* bind client on different port */
        in.sin_port = htons(port+1);
        if (bind(client_socket, (struct sockaddr *)&in, sizeof(in)) < 0) {
                perror("client: bind");
-               _exit(0);
+               fr_exit_now(0);
        }
 
        in.sin_port = htons(port);
@@ -493,7 +493,7 @@ client:
        if (sendto(client_socket, TESTSTRING, TESTLEN, 0,
                        (struct sockaddr *)&in, sizeof(in)) < 0) {
                perror("client: sendto");
-               _exit(0);
+               fr_exit_now(0);
        }
 
        printf("client: waiting for reply from server on INADDR_ANY:%d\n", port+1);
@@ -502,7 +502,7 @@ client:
            (struct sockaddr *)&from, &fl,
            (struct sockaddr *)&to, &tl)) < 0) {
                perror("client: recvfromto");
-               _exit(0);
+               fr_exit_now(0);
        }
 
        printf("client: received a packet of %d bytes [%s] ", n, buf);
@@ -511,7 +511,7 @@ client:
        printf(" dst ip:port %s:%d)\n",
                inet_ntoa(to.sin_addr), ntohs(to.sin_port));
 
-       _exit(0);
+       fr_exit_now(0);
 }
 
 #endif /* TESTING */
index d0835c27d76adc735a42f8e98a5a87c91b1e9e37..95782495808fac3623976ebe182aea59c67a4e86 100644 (file)
@@ -449,7 +449,7 @@ static void cf_item_add(CONF_SECTION *cs, CONF_ITEM *ci)
                                        cs->section_tree = rbtree_create(section_cmp, NULL, 0);
                                        if (!cs->section_tree) {
                                                ERROR("Out of memory");
-                                               _exit(1);
+                                               fr_exit_now(1);
                                        }
                                }
 
index 9068e4ac71e5f8ae2621e7d8cb7ff308311fd90a..23492d898771e8270343bcbc0073438bad1702c3 100644 (file)
@@ -358,7 +358,7 @@ int detail_recv(rad_listen_t *listener)
                        if (!data->fp) {
                                ERROR("FATAL: Failed to re-open detail file %s: %s",
                                       data->filename, strerror(errno));
-                               exit(1);
+                               fr_exit(1);
                        }
 
                        /*
@@ -626,7 +626,7 @@ int detail_recv(rad_listen_t *listener)
        packet = rad_alloc(NULL, 1);
        if (!packet) {
                ERROR("FATAL: Failed allocating memory for detail");
-               exit(1);
+               fr_exit(1);
        }
 
        memset(packet, 0, sizeof(*packet));
index d8df533d410b3751fd78a56ba7609026d91fc023..632919bed86810fcd124784430ccb959f868d2ab 100644 (file)
@@ -3078,7 +3078,7 @@ add_sockets:
                                        if (rcode != 0) {
                                                ERROR("Thread create failed: %s",
                                                      strerror(rcode));
-                                               exit(1);
+                                               fr_exit(1);
                                        }
 
                                        DEBUG("Thread %d for %s\n", i, buffer);
index 64115ea03e3b10742b489f40cee187b112226d85..6ac197fd0a49307eb2ec3628291020bf153c38e2 100644 (file)
@@ -422,17 +422,17 @@ void fr_suid_up(void)
 
        if (getresuid(&ruid, &euid, &suid) < 0) {
                ERROR("Failed getting saved UID's");
-               _exit(1);
+               fr_exit_now(1);
        }
 
        if (setresuid(-1, suid, -1) < 0) {
                ERROR("Failed switching to privileged user");
-               _exit(1);
+               fr_exit_now(1);
        }
 
        if (geteuid() != suid) {
                ERROR("Switched to unknown UID");
-               _exit(1);
+               fr_exit_now(1);
        }
 }
 
@@ -443,13 +443,13 @@ void fr_suid_down(void)
        if (setresuid(-1, server_uid, geteuid()) < 0) {
                fprintf(stderr, "%s: Failed switching to uid %s: %s\n",
                        progname, uid_name, strerror(errno));
-               _exit(1);
+               fr_exit_now(1);
        }
 
        if (geteuid() != server_uid) {
                fprintf(stderr, "%s: Failed switching uid: UID is incorrect\n",
                        progname);
-               _exit(1);
+               fr_exit_now(1);
        }
 
        fr_set_dumpable();
@@ -462,12 +462,12 @@ void fr_suid_down_permanent(void)
        if (setresuid(server_uid, server_uid, server_uid) < 0) {
                ERROR("Failed in permanent switch to uid %s: %s",
                       uid_name, strerror(errno));
-               _exit(1);
+               fr_exit_exit(1);
        }
 
        if (geteuid() != server_uid) {
                ERROR("Switched to unknown uid");
-               _exit(1);
+               fr_exit_now(1);
        }
 
        fr_set_dumpable();
@@ -486,7 +486,7 @@ void fr_suid_down(void)
        if (setuid(server_uid) < 0) {
                fprintf(stderr, "%s: Failed switching to uid %s: %s\n",
                        progname, uid_name, strerror(errno));
-               _exit(1);
+               fr_exit(1);
        }
 
        fr_set_dumpable();
@@ -794,7 +794,7 @@ int read_mainconfig(int reload)
        /*
         *      Switch users as early as possible.
         */
-       if (!switch_users(cs)) exit(1);
+       if (!switch_users(cs)) fr_exit(1);
 #endif
 
        /*
index 1fe049bbfb65693b634c9d440fb84d6e9556c356..85d5d83c43b309fa3d8941e39377e60a121f9155 100644 (file)
@@ -398,7 +398,7 @@ static void modcall_child(REQUEST *request, rlm_components_t component, int dept
 
        if (depth >= MODCALL_STACK_MAX) {
                ERROR("Internal sanity check failed: module stack is too deep");
-               exit(1);
+               fr_exit(1);
        }
 
        /*
@@ -607,7 +607,7 @@ redo:
 
                if (depth >= MODCALL_STACK_MAX) {
                        ERROR("Internal sanity check failed: module stack is too deep");
-                       exit(1);
+                       fr_exit(1);
                }
 
                /*
index 90333cccedc69f06cfc18b1421de1a28cc22b028..2590ade092a11bf3183284ac9b56cfa9995b2a7a 100644 (file)
@@ -249,14 +249,13 @@ static void request_coa_separate(REQUEST *coa);
 
 #define INSERT_EVENT(_function, _ctx) if (!fr_event_insert(el, _function, _ctx, &((_ctx)->when), &((_ctx)->ev))) { _rad_panic(__FILE__, __LINE__, "Failed to insert event"); }
 
-static void NEVER_RETURNS _rad_panic(char const *file, unsigned int line,
-                                   char const *msg)
+static void _rad_panic(char const *file, unsigned int line, char const *msg)
 {
        ERROR("[%s:%d] %s", file, line, msg);
 #ifndef NDEBUG
        rad_assert(0 == 1);
 #endif
-       _exit(1);
+       fr_exit(1);
 }
 
 #define rad_panic(x) _rad_panic(__FILE__, __LINE__, x)
@@ -560,7 +559,7 @@ STATE_MACHINE_DECL(request_done)
 #endif
                {
                        rad_assert("Internal sanity check failed");
-                       exit(2);
+                       fr_exit(2);
                }
 
                gettimeofday(&now, NULL);
@@ -3489,7 +3488,7 @@ static void event_socket_handler(UNUSED fr_event_list_t *xel, UNUSED int fd, voi
                       buffer);
 
                rad_panic("Socket was closed on us!");
-               _exit(1);
+               fr_exit_now(1);
        }
 
        listener->recv(listener);
@@ -3527,7 +3526,7 @@ static void event_poll_detail(void *ctx)
        if (!fr_event_insert(el, event_poll_detail, this,
                             &when, &detail->ev)) {
                ERROR("Failed creating handler");
-               exit(1);
+               fr_exit(1);
        }
 }
 #endif
@@ -3693,7 +3692,7 @@ int event_new_fd(rad_listen_t *this)
                if (!fr_event_fd_insert(el, 0, this->fd,
                                        event_socket_handler, this)) {
                        ERROR("Failed adding event handler for socket!");
-                       exit(1);
+                       fr_exit(1);
                }
                FD_MUTEX_UNLOCK(&fd_mutex);
 
@@ -3719,7 +3718,7 @@ int event_new_fd(rad_listen_t *this)
                                                          this->fd)) {
                                radlog(L_ERR, "Fatal error freezing socket: %s",
                                       fr_strerror());
-                               exit(1);
+                               fr_exit(1);
                        }
                        PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
                }
@@ -3790,12 +3789,12 @@ int event_new_fd(rad_listen_t *this)
                if (devnull < 0) {
                        ERROR("FATAL failure opening /dev/null: %s",
                               strerror(errno));
-                       exit(1);
+                       fr_exit(1);
                }
                if (dup2(devnull, this->fd) < 0) {
                        ERROR("FATAL failure closing socket: %s",
                               strerror(errno));
-                       exit(1);
+                       fr_exit(1);
                }
                close(devnull);
 
@@ -3820,7 +3819,7 @@ int event_new_fd(rad_listen_t *this)
                        if (!fr_packet_list_socket_del(proxy_list, this->fd)) {
                                ERROR("Fatal error removing socket: %s",
                                      fr_strerror());
-                               exit(1);
+                               fr_exit(1);
                        }
                        if (sock->home &&  sock->home->limit.num_connections) {
                                sock->home->limit.num_connections--;
@@ -4056,7 +4055,7 @@ int radius_event_init(CONF_SECTION *cs, int have_children)
                if (pthread_mutex_init(&proxy_mutex, NULL) != 0) {
                        ERROR("FATAL: Failed to initialize proxy mutex: %s",
                               strerror(errno));
-                       exit(1);
+                       fr_exit(1);
                }
 #endif
        }
@@ -4071,7 +4070,7 @@ int radius_event_init(CONF_SECTION *cs, int have_children)
         */
        if (have_children && !check_config &&
            (thread_pool_init(cs, &have_children) < 0)) {
-               exit(1);
+               fr_exit(1);
        }
 #endif
 
@@ -4087,7 +4086,7 @@ int radius_event_init(CONF_SECTION *cs, int have_children)
                       mainconfig.name);
                if (listen_init(cs, &head, spawn_flag) < 0) {
                        fflush(NULL);
-                       exit(1);
+                       fr_exit(1);
                }
                return 1;
        }
@@ -4100,25 +4099,25 @@ int radius_event_init(CONF_SECTION *cs, int have_children)
        if (pipe(self_pipe) < 0) {
                ERROR("radiusd: Error opening internal pipe: %s",
                       strerror(errno));
-               exit(1);
+               fr_exit(1);
        }
        if ((fcntl(self_pipe[0], F_SETFL, O_NONBLOCK) < 0) ||
            (fcntl(self_pipe[0], F_SETFD, FD_CLOEXEC) < 0)) {
                ERROR("radiusd: Error setting internal flags: %s",
                       strerror(errno));
-               exit(1);
+               fr_exit(1);
        }
        if ((fcntl(self_pipe[1], F_SETFL, O_NONBLOCK) < 0) ||
            (fcntl(self_pipe[1], F_SETFD, FD_CLOEXEC) < 0)) {
                ERROR("radiusd: Error setting internal flags: %s",
                       strerror(errno));
-               exit(1);
+               fr_exit(1);
        }
 
        if (!fr_event_fd_insert(el, 0, self_pipe[0],
                                  event_signal_handler, el)) {
                ERROR("Failed creating handler for signals");
-               exit(1);
+               fr_exit(1);
        }
 #endif /* WITH_SELF_PIPE */
 
@@ -4135,7 +4134,7 @@ int radius_event_init(CONF_SECTION *cs, int have_children)
        *       uid.
        */
        if (listen_init(cs, &head, spawn_flag) < 0) {
-               _exit(1);
+               fr_exit_now(1);
        }
 
        mainconfig.listen = head;
index d0913ab1c543f54904ec9f72d47b16f702f90765..75c99baad32f6b78dc3e497acf33f827ce8eaf94 100644 (file)
@@ -2070,7 +2070,7 @@ void home_server_update_request(home_server *home, REQUEST *request)
                request->proxy = rad_alloc(request, true);
                if (!request->proxy) {
                        ERROR("no memory");
-                       exit(1);
+                       fr_exit(1);
                }
 
                /*
index 5cef308076d35780e778e1f87d7c8cf30ea8fc66..5c9641509b5fc5ea07af4a7a5926d2b7b3f27747 100644 (file)
@@ -1032,9 +1032,8 @@ int thread_pool_init(UNUSED CONF_SECTION *cs, int *spawn_flag)
 #else
        thread_pool.queue = dispatch_queue_create("org.freeradius.threads", NULL);
        if (!thread_pool.queue) {
-               ERROR("Failed creating dispatch queue: %s\n",
-                      strerror(errno));
-               exit(1);
+               ERROR("Failed creating dispatch queue: %s", strerror(errno));
+               fr_exit(1);
        }
 #endif
 
index 9850ff037250f8d0a2e67f4e747260ce64c47fa3..9970e8e435d6cbe5adc9471aa43285d9662cde89 100644 (file)
@@ -359,7 +359,7 @@ void *rad_malloc(size_t size)
 
        if (ptr == NULL) {
                ERROR("no memory");
-               exit(1);
+               fr_exit(1);
        }
 
        return ptr;
index 6bc4392811e08b0684cea8a5aa54cf702be4366d..b9a017976700cdf6fdbbc493b9d3a925f56d9285 100644 (file)
@@ -780,7 +780,7 @@ VALUE_PAIR *radius_paircreate(REQUEST *request, VALUE_PAIR **vps,
        if (!vp) {
                ERROR("No memory!");
                rad_assert("No memory" == NULL);
-               _exit(1);
+               fr_exit_now(1);
        }
 
        if (vps) pairadd(vps, vp);