Module Name: src
Committed By: snj
Date: Sat Mar 18 05:02:28 UTC 2017
Modified Files:
src/usr.bin/ftp [netbsd-7]: fetch.c
Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1353):
usr.bin/ftp/fetch.c: revision 1.227
Use the first name we requested the http/https URL for, not any name we ended
up with after random redirects.
To generate a diff of this commit:
cvs rdiff -u -r1.205.4.6 -r1.205.4.7 src/usr.bin/ftp/fetch.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/ftp/fetch.c
diff -u src/usr.bin/ftp/fetch.c:1.205.4.6 src/usr.bin/ftp/fetch.c:1.205.4.7
--- src/usr.bin/ftp/fetch.c:1.205.4.6 Sun Dec 18 08:03:09 2016
+++ src/usr.bin/ftp/fetch.c Sat Mar 18 05:02:28 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: fetch.c,v 1.205.4.6 2016/12/18 08:03:09 snj Exp $ */
+/* $NetBSD: fetch.c,v 1.205.4.7 2017/03/18 05:02:28 snj Exp $ */
/*-
* Copyright (c) 1997-2015 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.205.4.6 2016/12/18 08:03:09 snj Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.205.4.7 2017/03/18 05:02:28 snj Exp $");
#endif /* not lint */
/*
@@ -1368,6 +1368,12 @@ fetch_url(const char *url, const char *p
savefile = ftp_strdup(cp + 1);
else
savefile = ftp_strdup(decodedpath);
+ /*
+ * Use the first URL we requested not the name after a
+ * possible redirect, but careful to save it because our
+ * "safety" check is the match to outfile.
+ */
+ outfile = ftp_strdup(savefile);
}
DPRINTF("%s: savefile `%s'\n", __func__, savefile);
if (EMPTYSTRING(savefile)) {