Files
termux-packages/packages/coreutils/fix-paths.patch
2025-11-16 18:06:23 +00:00

93 lines
3.7 KiB
Diff

diff --git coreutils-9.9/lib/tmpdir.c coreutils-9.9/lib/tmpdir.c
index db1f1e4..36a8541 100644
--- coreutils-9.9/lib/tmpdir.c
+++ coreutils-9.9/lib/tmpdir.c
@@ -35,7 +35,7 @@
# ifdef _P_tmpdir /* native Windows */
# define P_tmpdir _P_tmpdir
# else
-# define P_tmpdir "/tmp"
+# define P_tmpdir "@TERMUX_PREFIX@/tmp"
# endif
#endif
@@ -135,8 +135,8 @@ path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
#endif
if (direxists (P_tmpdir))
dir = P_tmpdir;
- else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
- dir = "/tmp";
+ else if (strcmp (P_tmpdir, "@TERMUX_PREFIX@/tmp") != 0 && direxists ("@TERMUX_PREFIX@/tmp"))
+ dir = "@TERMUX_PREFIX@/tmp";
else
{
__set_errno (ENOENT);
diff --git coreutils-9.9/src/mktemp.c coreutils-9.9/src/mktemp.c
index 706c651..4004876 100644
--- coreutils-9.9/src/mktemp.c
+++ coreutils-9.9/src/mktemp.c
@@ -83,7 +83,7 @@ Files are created u+rw, and directories u+rwx, minus umask restrictions.\n\
"), stdout);
fputs (_("\
-p DIR, --tmpdir[=DIR] interpret TEMPLATE relative to DIR; if DIR is not\n\
- specified, use $TMPDIR if set, else /tmp. With\n\
+ specified, use $TMPDIR if set, else @TERMUX_PREFIX@/tmp. With\n\
this option, TEMPLATE must not be an absolute name;\n\
unlike with -t, TEMPLATE may contain slashes, but\n\
mktemp creates only the final component\n\
@@ -91,7 +91,7 @@ Files are created u+rw, and directories u+rwx, minus umask restrictions.\n\
fputs (_("\
-t interpret TEMPLATE as a single file name component,\n\
relative to a directory: $TMPDIR, if set; else the\n\
- directory specified via -p; else /tmp [deprecated]\n\
+ directory specified via -p; else @TERMUX_PREFIX@/tmp [deprecated]\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
@@ -273,7 +273,7 @@ main (int argc, char **argv)
else if (dest_dir_arg && *dest_dir_arg)
dest_dir = dest_dir_arg;
else
- dest_dir = "/tmp";
+ dest_dir = "@TERMUX_PREFIX@/tmp";
if (last_component (template) != template)
error (EXIT_FAILURE, 0,
@@ -287,7 +287,7 @@ main (int argc, char **argv)
else
{
char *env = getenv ("TMPDIR");
- dest_dir = (env && *env ? env : "/tmp");
+ dest_dir = (env && *env ? env : "@TERMUX_PREFIX@/tmp");
}
if (IS_ABSOLUTE_FILE_NAME (template))
error (EXIT_FAILURE, 0,
diff --git coreutils-9.9/src/sort.c coreutils-9.9/src/sort.c
index 05d00cc..dec6516 100644
--- coreutils-9.9/src/sort.c
+++ coreutils-9.9/src/sort.c
@@ -93,9 +93,7 @@ struct rlimit { size_t rlim_cur; };
#define UCHAR_LIM (UCHAR_MAX + 1)
-#ifndef DEFAULT_TMPDIR
-# define DEFAULT_TMPDIR "/tmp"
-#endif
+#define DEFAULT_TMPDIR "@TERMUX_PREFIX@/tmp"
/* Maximum number of lines to merge every time a NODE is taken from
the merge queue. Node is at LEVEL in the binary merge tree,
diff --git coreutils-9.9/src/split.c coreutils-9.9/src/split.c
index 3d15091..eea9cbd 100644
--- coreutils-9.9/src/split.c
+++ coreutils-9.9/src/split.c
@@ -551,7 +551,7 @@ create (char const *name)
char const *shell_prog = getenv ("SHELL");
if (shell_prog == nullptr)
- shell_prog = "/bin/sh";
+ shell_prog = "@TERMUX_PREFIX@/bin/sh";
char const *const argv[] = { last_component (shell_prog), "-c",
filter_command, nullptr };