]> git.sommitrealweird.co.uk Git - onak.git/blobdiff - add.c
Update version to mark arch build.
[onak.git] / add.c
diff --git a/add.c b/add.c
index 10627f281105d8bb3369aaf5c122b7d37e2086c0..167e5bd46aa13a0380fcd8e288eecce19f2cb478 100644 (file)
--- 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);