From 27b2baf8423dda719ddac4926c43bdddb427ee1f Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Mon, 29 Jun 2020 20:25:50 +0200 Subject: server: Check that constructor attributes work on the system --- main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.c b/main.c index 78c98cb..bec763f 100644 --- a/main.c +++ b/main.c @@ -148,7 +148,17 @@ void signal_handler(int sig){ } } +static bool constructors_work = false; + +__attribute__((constructor)) +static void constructor(void) { constructors_work = true; } + int main(int argc,char **argv){ + if (!constructors_work) { + fprintf(stderr, "This platform does not support application constructors, which tomsg requires\n"); + return 1; + } + srandomdev(); if(sodium_init()<0){ fprintf(stderr,"Could not initialise libsodium!\n"); -- cgit v1.2.3-54-g00ecf