mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-24 18:30:38 -05:00
This commit converts the license handling to adhere to the REUSE
specification. It specifically:
1. Adds used licnses to LICENSES/ directory
2. Add "isc" template for adding the copyright boilerplate
3. Changes all source files to include copyright and SPDX license
header, this includes all the C sources, documentation, zone files,
configuration files. There are notes in the doc/dev/copyrights file
on how to add correct headers to the new files.
4. Handle the rest that can't be modified via .reuse/dep5 file. The
binary (or otherwise unmodifiable) files could have license places
next to them in <foo>.license file, but this would lead to cluttered
repository and most of the files handled in the .reuse/dep5 file are
system test files.
(cherry picked from commit 58bd26b6cf)
88 lines
1.8 KiB
C
88 lines
1.8 KiB
C
/*
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
*
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
* information regarding copyright ownership.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include <isc/backtrace.h>
|
|
#include <isc/print.h>
|
|
#include <isc/result.h>
|
|
|
|
const char *expected_symbols[] = { "func3", "func2", "func1", "main" };
|
|
|
|
static int
|
|
func3() {
|
|
void *tracebuf[16];
|
|
int i, nframes;
|
|
int error = 0;
|
|
const char *fname;
|
|
isc_result_t result;
|
|
unsigned long offset;
|
|
|
|
result = isc_backtrace_gettrace(tracebuf, 16, &nframes);
|
|
if (result != ISC_R_SUCCESS) {
|
|
printf("isc_backtrace_gettrace failed: %s\n",
|
|
isc_result_totext(result));
|
|
return (1);
|
|
}
|
|
|
|
if (nframes < 4) {
|
|
error++;
|
|
}
|
|
|
|
for (i = 0; i < 4 && i < nframes; i++) {
|
|
fname = NULL;
|
|
result = isc_backtrace_getsymbol(tracebuf[i], &fname, &offset);
|
|
if (result != ISC_R_SUCCESS) {
|
|
error++;
|
|
continue;
|
|
}
|
|
if (strcmp(fname, expected_symbols[i]) != 0) {
|
|
error++;
|
|
}
|
|
}
|
|
|
|
if (error) {
|
|
printf("Unexpected result:\n");
|
|
printf(" # of frames: %d (expected: at least 4)\n", nframes);
|
|
printf(" symbols:\n");
|
|
for (i = 0; i < nframes; i++) {
|
|
fname = NULL;
|
|
result = isc_backtrace_getsymbol(tracebuf[i], &fname,
|
|
&offset);
|
|
if (result == ISC_R_SUCCESS) {
|
|
printf(" [%d] %s\n", i, fname);
|
|
} else {
|
|
printf(" [%d] %p getsymbol failed: %s\n", i,
|
|
tracebuf[i], isc_result_totext(result));
|
|
}
|
|
}
|
|
}
|
|
|
|
return (error);
|
|
}
|
|
|
|
static int
|
|
func2() {
|
|
return (func3());
|
|
}
|
|
|
|
static int
|
|
func1() {
|
|
return (func2());
|
|
}
|
|
|
|
int
|
|
main() {
|
|
return (func1());
|
|
}
|