diff -u -r ../ruby-2.4.0/ext/etc/etc.c ./ext/etc/etc.c
--- ../ruby-2.4.0/ext/etc/etc.c	2016-06-02 14:21:42.000000000 +0200
+++ ./ext/etc/etc.c	2017-01-18 04:18:25.912737382 +0100
@@ -651,7 +651,7 @@
     if (!len) return Qnil;
     tmpdir = rb_w32_conv_from_wchar(path, rb_filesystem_encoding());
 #else
-    const char default_tmp[] = "/tmp";
+    const char default_tmp[] = "@TERMUX_PREFIX@/tmp";
     const char *tmpstr = default_tmp;
     size_t tmplen = strlen(default_tmp);
 # if defined _CS_DARWIN_USER_TEMP_DIR
