termux-packages/packages/wget2/fix-hardcoded-paths.patch

52 lines
1.7 KiB
Diff

diff -uNr a/lib/tempname.c b/lib/tempname.c
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -141,8 +141,8 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
{
if (direxists (P_tmpdir))
dir = P_tmpdir;
- else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
- dir = "/tmp";
+ else if (direxists ("@TERMUX_PREFIX@/tmp"))
+ dir = "@TERMUX_PREFIX@/tmp";
else
{
__set_errno (ENOENT);
diff -uNr a/libwget/io.c b/libwget/io.c
--- a/libwget/io.c
+++ b/libwget/io.c
@@ -377,7 +377,7 @@ int wget_update_file(const char *fname,
// find out system temp directory
if (!(tmpdir = getenv("TMPDIR")) && !(tmpdir = getenv("TMP"))
&& !(tmpdir = getenv("TEMP")) && !(tmpdir = getenv("TEMPDIR")))
- tmpdir = "/tmp";
+ tmpdir = "@TERMUX_PREFIX@/tmp";
basename = base_name(fname);
diff -uNr a/libwget/ssl_gnutls.c b/libwget/ssl_gnutls.c
--- a/libwget/ssl_gnutls.c
+++ b/libwget/ssl_gnutls.c
@@ -1290,7 +1290,7 @@ void wget_ssl_init(void)
ncerts = 0;
if (!strcmp(config.ca_directory, "system"))
- config.ca_directory = "/etc/ssl/certs";
+ config.ca_directory = "@TERMUX_PREFIX@/etc/tls/certs";
if ((dir = opendir(config.ca_directory))) {
struct dirent *dp;
diff -uNr a/libwget/ssl_openssl.c b/libwget/ssl_openssl.c
index c836afd..128ac29 100644
--- a/libwget/ssl_openssl.c
+++ b/libwget/ssl_openssl.c
@@ -462,7 +462,7 @@ static int openssl_load_trust_files(SSL_CTX *ctx, const char *dir)
goto end;
}
- dir = "/etc/ssl/certs";
+ dir = "@TERMUX_PREFIX@/etc/tls/certs";
info_printf(_("OpenSSL: Could not load certificates from default paths. Falling back to '%s'."), dir);
}