aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-06-29 20:25:50 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-06-29 20:25:50 +0200
commit27b2baf8423dda719ddac4926c43bdddb427ee1f (patch)
tree750d4d005815ecdf49a13dac565878849d6ee098
parentba849f06d5c287e6d04e5cc91fe96c0a54df3199 (diff)
server: Check that constructor attributes work on the system
-rw-r--r--main.c10
1 files changed, 10 insertions, 0 deletions
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");