--- ./contrib/pg_trgm/trgm_regexp.c 2021-05-11 02:11:42.000000000 +0530 +++ ./contrib/pg_trgm/trgm_regexp.c.mod 2021-06-17 12:12:01.025156011 +0530 @@ -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); --- ./src/bin/initdb/initdb.c 2021-05-11 02:11:42.000000000 +0530 +++ ./src/bin/initdb/initdb.c.mod 2021-06-17 12:16:34.435155906 +0530 @@ -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 --- ./src/bin/pg_ctl/pg_ctl.c 2021-05-11 02:11:42.000000000 +0530 +++ ./src/bin/pg_ctl/pg_ctl.c.mod 2021-06-17 12:18:58.955155851 +0530 @@ -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", "@TERMUX_PREFIX@/bin/sh", "-c", cmd, (char *) NULL); /* exec failed */ write_stderr(_("%s: could not start server: %s\n"), --- ./src/bin/pg_upgrade/check.c 2021-05-11 02:11:42.000000000 +0530 +++ ./src/bin/pg_upgrade/check.c.mod 2021-06-17 12:21:44.835155788 +0530 @@ -630,7 +630,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 */ --- ./src/bin/psql/command.c 2021-05-11 02:11:42.000000000 +0530 +++ ./src/bin/psql/command.c.mod 2021-06-17 12:25:14.125155708 +0530 @@ -3707,7 +3707,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; @@ -3736,7 +3736,7 @@ const char *tmpdir = getenv("TMPDIR"); if (!tmpdir) - tmpdir = "/tmp"; + tmpdir = "@TERMUX_PREFIX@/tmp"; #else char tmpdir[MAXPGPATH]; int ret; @@ -4740,7 +4740,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 --- ./src/include/pg_config_manual.h 2021-05-11 02:11:42.000000000 +0530 +++ ./src/include/pg_config_manual.h.mod 2021-06-17 12:27:13.665155663 +0530 @@ -208,7 +208,7 @@ * support them yet. */ #ifndef WIN32 -#define DEFAULT_PGSOCKET_DIR "/tmp" +#define DEFAULT_PGSOCKET_DIR "@TERMUX_PREFIX@/tmp" #else #define DEFAULT_PGSOCKET_DIR "" #endif