X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/7350475e98ed6302e0143a7e7c9ab7877ea58a1a..408ea0b9ceafdc9f861701cfb14b57d09aa47777:/add.c?ds=sidebyside diff --git a/add.c b/add.c index 10627f2..167e5bd 100644 --- a/add.c +++ b/add.c @@ -68,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);