David Lamparter | 4d474fa | 2013-11-19 15:00:06 +0100 | [diff] [blame] | 1 | /* |
| 2 | * SEGV / backtrace handling test. |
| 3 | * |
| 4 | * copied from test-sig.c |
| 5 | * |
| 6 | * Copyright (C) 2013 by David Lamparter, Open Source Routing. |
| 7 | * Copyright (C) 2013 by Internet Systems Consortium, Inc. ("ISC") |
| 8 | * |
| 9 | * This file is part of Quagga |
| 10 | * |
| 11 | * Quagga is free software; you can redistribute it and/or modify it |
| 12 | * under the terms of the GNU General Public License as published by the |
| 13 | * Free Software Foundation; either version 2, or (at your option) any |
| 14 | * later version. |
| 15 | * |
| 16 | * Quagga is distributed in the hope that it will be useful, but |
| 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 | * General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with Quagga; see the file COPYING. If not, write to the Free |
| 23 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 24 | * 02111-1307, USA. |
| 25 | */ |
| 26 | |
| 27 | #include <zebra.h> |
| 28 | #include <sigevent.h> |
| 29 | #include "lib/log.h" |
| 30 | #include "lib/memory.h" |
| 31 | |
| 32 | struct quagga_signal_t sigs[] = |
| 33 | { |
| 34 | }; |
| 35 | |
| 36 | struct thread_master *master; |
| 37 | |
| 38 | int |
| 39 | threadfunc (struct thread *thread) |
| 40 | { |
| 41 | int *null = NULL; |
| 42 | *null += 1; |
| 43 | return 0; |
| 44 | } |
| 45 | |
| 46 | int |
| 47 | main (void) |
| 48 | { |
| 49 | master = thread_master_create (); |
| 50 | signal_init (master, array_size(sigs), sigs); |
| 51 | |
| 52 | zlog_default = openzlog("testsegv", ZLOG_NONE, |
| 53 | LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON); |
| 54 | zlog_set_level (NULL, ZLOG_DEST_SYSLOG, ZLOG_DISABLED); |
| 55 | zlog_set_level (NULL, ZLOG_DEST_STDOUT, LOG_DEBUG); |
| 56 | zlog_set_level (NULL, ZLOG_DEST_MONITOR, ZLOG_DISABLED); |
| 57 | |
| 58 | thread_execute (master, threadfunc, 0, 0); |
| 59 | |
| 60 | exit (0); |
| 61 | } |