diff -u -r ../perl-5.22.0/dist/PathTools/Cwd.pm ./dist/PathTools/Cwd.pm
--- ../perl-5.24.1/dist/PathTools/Cwd.pm	2016-07-25 09:12:20.000000000 +0000
+++ ./dist/PathTools/Cwd.pm	2017-02-28 20:36:10.314765294 +0000
@@ -179,9 +179,8 @@
 # so everything works under taint mode.
 my $pwd_cmd;
 if($^O ne 'MSWin32') {
-    foreach my $try ('/bin/pwd',
-		     '/usr/bin/pwd',
-		     '/QOpenSys/bin/pwd', # OS/400 PASE.
+    foreach my $try ('@TERMUX_PREFIX@/bin/applets/pwd',
+		     '@TERMUX_PREFIX@/bin/pwd'
 		    ) {
 	if( -x $try ) {
 	    $pwd_cmd = $try;
@@ -198,7 +197,7 @@
 if ($^O =~ /android/) {
     # If targetsh is executable, then we're either a full
     # perl, or a miniperl for a native build.
-    if (-x $Config::Config{targetsh}) {
+    if (defined($Config::Config{targetsh}) && -x $Config::Config{targetsh}) {
         $pwd_cmd = "$Config::Config{targetsh} -c pwd"
     }
     else {