diff -uNr postgresql-13.0/contrib/pg_trgm/trgm_regexp.c postgresql-13.0.mod/contrib/pg_trgm/trgm_regexp.c --- postgresql-13.0/contrib/pg_trgm/trgm_regexp.c 2020-09-21 23:47:36.000000000 +0300 +++ postgresql-13.0.mod/contrib/pg_trgm/trgm_regexp.c 2020-10-19 21:31:14.749878910 +0300 @@ -2173,7 +2173,7 @@ { /* dot -Tpng -o /tmp/source.png < /tmp/source.gv */ - FILE *fp = fopen("/tmp/source.gv", "w"); + FILE *fp = fopen("@TERMUX_PREFIX@/tmp/source.gv", "w"); fprintf(fp, "%s", buf.data); fclose(fp); @@ -2235,7 +2235,7 @@ { /* dot -Tpng -o /tmp/transformed.png < /tmp/transformed.gv */ - FILE *fp = fopen("/tmp/transformed.gv", "w"); + FILE *fp = fopen("@TERMUX_PREFIX@/tmp/transformed.gv", "w"); fprintf(fp, "%s", buf.data); fclose(fp); @@ -2326,7 +2326,7 @@ { /* dot -Tpng -o /tmp/packed.png < /tmp/packed.gv */ - FILE *fp = fopen("/tmp/packed.gv", "w"); + FILE *fp = fopen("@TERMUX_PREFIX@/tmp/packed.gv", "w"); fprintf(fp, "%s", buf.data); fclose(fp); diff -uNr postgresql-13.0/src/bin/initdb/initdb.c postgresql-13.0.mod/src/bin/initdb/initdb.c --- postgresql-13.0/src/bin/initdb/initdb.c 2020-09-21 23:47:36.000000000 +0300 +++ postgresql-13.0.mod/src/bin/initdb/initdb.c 2020-10-19 21:31:14.749878910 +0300 @@ -1095,7 +1095,7 @@ #else snprintf(repltok, sizeof(repltok), "#unix_socket_directories = ''"); #endif - conflines = replace_token(conflines, "#unix_socket_directories = '/tmp'", + conflines = replace_token(conflines, "#unix_socket_directories = '@TERMUX_PREFIX@/tmp'", repltok); #if DEF_PGPORT != 5432 diff -uNr postgresql-13.0/src/bin/pg_ctl/pg_ctl.c postgresql-13.0.mod/src/bin/pg_ctl/pg_ctl.c --- postgresql-13.0/src/bin/pg_ctl/pg_ctl.c 2020-09-21 23:47:36.000000000 +0300 +++ postgresql-13.0.mod/src/bin/pg_ctl/pg_ctl.c 2020-10-19 21:31:14.749878910 +0300 @@ -494,7 +494,7 @@ snprintf(cmd, MAXPGPATH, "exec \"%s\" %s%s < \"%s\" 2>&1", exec_path, pgdata_opt, post_opts, DEVNULL); - (void) execl("/bin/sh", "/bin/sh", "-c", cmd, (char *) NULL); + (void) execl("@TERMUX_PREFIX@/bin/sh", "sh", "-c", cmd, (char *) NULL); /* exec failed */ write_stderr(_("%s: could not start server: %s\n"), diff -uNr postgresql-13.0/src/bin/pg_upgrade/check.c postgresql-13.0.mod/src/bin/pg_upgrade/check.c --- postgresql-13.0/src/bin/pg_upgrade/check.c 2020-09-21 23:47:36.000000000 +0300 +++ postgresql-13.0.mod/src/bin/pg_upgrade/check.c 2020-10-19 21:31:14.753878949 +0300 @@ -474,7 +474,7 @@ #ifndef WIN32 /* add shebang header */ - fprintf(script, "#!/bin/sh\n\n"); + fprintf(script, "#!@TERMUX_PREFIX@/bin/sh\n\n"); #else /* suppress command echoing */ fprintf(script, "@echo off\n"); @@ -602,7 +602,7 @@ #ifndef WIN32 /* add shebang header */ - fprintf(script, "#!/bin/sh\n\n"); + fprintf(script, "#!@TERMUX_PREFIX@/bin/sh\n\n"); #endif /* delete old cluster's default tablespace */ diff -uNr postgresql-13.0/src/bin/psql/command.c postgresql-13.0.mod/src/bin/psql/command.c --- postgresql-13.0/src/bin/psql/command.c 2020-09-21 23:47:36.000000000 +0300 +++ postgresql-13.0.mod/src/bin/psql/command.c 2020-10-19 21:31:14.753878949 +0300 @@ -3577,7 +3577,7 @@ if (result == -1) pg_log_error("could not start editor \"%s\"", editorName); else if (result == 127) - pg_log_error("could not start /bin/sh"); + pg_log_error("could not start @TERMUX_PREFIX@/bin/sh"); free(sys); return result == 0; @@ -3607,7 +3607,7 @@ const char *tmpdir = getenv("TMPDIR"); if (!tmpdir) - tmpdir = "/tmp"; + tmpdir = "@TERMUX_PREFIX@/tmp"; #else char tmpdir[MAXPGPATH]; int ret; @@ -4590,7 +4590,7 @@ #ifndef WIN32 -#define DEFAULT_SHELL "/bin/sh" +#define DEFAULT_SHELL "@TERMUX_PREFIX@/bin/sh" #else /* * CMD.EXE is in different places in different Win32 releases so we diff -uNr postgresql-13.0/src/include/pg_config_manual.h postgresql-13.0.mod/src/include/pg_config_manual.h --- postgresql-13.0/src/include/pg_config_manual.h 2020-09-21 23:47:36.000000000 +0300 +++ postgresql-13.0.mod/src/include/pg_config_manual.h 2020-10-19 21:31:30.978039951 +0300 @@ -201,7 +201,7 @@ * support them yet. */ #ifndef WIN32 -#define DEFAULT_PGSOCKET_DIR "/tmp" +#define DEFAULT_PGSOCKET_DIR "@TERMUX_PREFIX@/tmp" #else #define DEFAULT_PGSOCKET_DIR "" #endif