plug fd leak introduced in "avoid toctu" rewrite.
authorflorian <florian@openbsd.org>
Mon, 29 Apr 2024 16:17:46 +0000 (16:17 +0000)
committerflorian <florian@openbsd.org>
Mon, 29 Apr 2024 16:17:46 +0000 (16:17 +0000)
Issue reported by job
OK tb, job

usr.sbin/httpd/server_file.c

index 851ad46..cdcc11c 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: server_file.c,v 1.79 2024/04/16 17:15:50 florian Exp $        */
+/*     $OpenBSD: server_file.c,v 1.80 2024/04/29 16:17:46 florian Exp $        */
 
 /*
  * Copyright (c) 2006 - 2017 Reyk Floeter <reyk@openbsd.org>
@@ -287,6 +287,7 @@ server_file_request(struct httpd *env, struct client *clt, struct media_type
                if ((ret = server_response_http(clt, ret, media, -1,
                    MINIMUM(time(NULL), st->st_mtim.tv_sec))) == -1)
                        goto fail;
+               close(fd);
                goto done;
        }