X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/7350475e98ed6302e0143a7e7c9ab7877ea58a1a..567528bebc2dd1a8ccb672d11b22cbe71b292deb:/add.c?ds=inline 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);