Skip to content

Commit

Permalink
Update s2n to compile on FreeBSD (aws#2272)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexw91 authored Sep 8, 2020
1 parent 536c77e commit 0e4c9da
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ include(CheckCSourceCompiles)
check_c_source_compiles("
#include <execinfo.h>
int main() {
void *array[20];
int backtrace_size = backtrace(array, 20);
backtrace_symbols(array, backtrace_size);
return 0;
}" S2N_HAVE_EXECINFO)

Expand Down
2 changes: 2 additions & 0 deletions bin/s2nd.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,9 @@ int main(int argc, char *const *argv)
struct sigaction sa;

sa.sa_handler = SIG_IGN;
#if defined(SA_NOCLDWAIT)
sa.sa_flags = SA_NOCLDWAIT;
#endif
sigemptyset(&sa.sa_mask);
sigaction(SIGCHLD, &sa, NULL);
}
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/s2n_rfc5952_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

#include <arpa/inet.h>

#if defined(__FreeBSD__)
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#endif

#include "utils/s2n_rfc5952.h"

int main(int argc, char **argv)
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/s2n_stacktrace_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ int raises_error()
int main(int argc, char **argv)
{
BEGIN_TEST();
#ifdef S2N_HAVE_EXECINFO
EXPECT_SUCCESS(s2n_stack_traces_enabled_set(true));
struct s2n_stacktrace trace;
/* If nothing has errored yet, we have no stacktrace */
Expand All @@ -48,4 +49,7 @@ int main(int argc, char **argv)
/* Free the stacktrace to avoid memory leaks */
EXPECT_SUCCESS(s2n_free_stacktrace());
END_TEST();
#else
END_TEST();
#endif
}
2 changes: 1 addition & 1 deletion utils/s2n_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

#define _DEFAULT_SOURCE 1
#if !defined(__APPLE__)
#if !defined(__APPLE__) && !defined(__FreeBSD__)
#include <features.h>
#endif

Expand Down

0 comments on commit 0e4c9da

Please sign in to comment.