From a0d60019afa3ab214dcb1edb63a7155f3279da5b Mon Sep 17 00:00:00 2001 From: des Date: Wed, 23 Jan 2008 20:57:59 +0000 Subject: Fix a regression introduced in rev 1.99: replace fclose(f) with a comment explaining why f cannot possibly be a valid FILE * at this point. MFC after: 1 day --- lib/libfetch/ftp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/libfetch') diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c index 914f674..475adda 100644 --- a/lib/libfetch/ftp.c +++ b/lib/libfetch/ftp.c @@ -1181,7 +1181,11 @@ fetchStatFTP(struct url *url, struct url_stat *us, const char *flags) f = ftp_request(url, "STAT", us, ftp_get_proxy(url, flags), flags); if (f == NULL) return (-1); - fclose(f); + /* + * When op is "STAT", ftp_request() will return either NULL or + * (FILE *)1, never a valid FILE *, so we mustn't fclose(f) before + * returning, as it would cause a segfault. + */ return (0); } -- cgit v1.1