Don't leak FD's while serving static files if they're not there
authorWilfried Goesgens <dothebart@citadel.org>
Fri, 26 Nov 2010 13:44:31 +0000 (14:44 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Sat, 27 Nov 2010 12:58:52 +0000 (13:58 +0100)
Ok, this case is rather theoretic, but if for some reason files disappear
after webcits start initialising, we might hit this point.

webcit/static.c

index 11b868ad5f56578214a9f1da1b0351f6ace2d5a6..145014bc932b821ab315ed88e80811f644f28201 100644 (file)
@@ -60,6 +60,7 @@ void output_static(const char *what)
                        begin_burst();
                        wc_printf("Cannot fstat %s: %s\n", what, strerror(errno));
                        end_burst();
+                       if (fd > 0) close(fd);
                        return;
                }