X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/fd58db2034c6781399583384055ce69fc300b26b..408ea0b9ceafdc9f861701cfb14b57d09aa47777:/add.c diff --git a/add.c b/add.c index 46f5ecf..167e5bd 100644 --- a/add.c +++ b/add.c @@ -23,7 +23,6 @@ #include "merge.h" #include "onak-conf.h" #include "parsekey.h" -#include "sendsync.h" int main(int argc, char *argv[]) { @@ -69,8 +68,13 @@ int main(int argc, char *argv[]) count); printf("Storing %d keys.\n", count); end_html(); - fclose(stdout); - fclose(stderr); + if (stdout != NULL && fileno(stdout) != -1) { + fclose(stdout); + } + if (stderr != NULL && stderr != stdout && + fileno(stderr) != -1) { + fclose(stderr); + } catchsignals(); initdb(false);