aboutsummaryrefslogtreecommitdiffstats
path: root/hashcmd.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1998-04-17 19:52:44 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:51 +0000
commitcce855bc5b117cb7ae70064131120687bc69fac0 (patch)
tree39c7a4ec8f6d22ef03df74f2684e6a04fef10399 /hashcmd.c
parente8ce775db824de329b81293b4e5d8fbd65624528 (diff)
downloadandroid_external_bash-cce855bc5b117cb7ae70064131120687bc69fac0.tar.gz
android_external_bash-cce855bc5b117cb7ae70064131120687bc69fac0.tar.bz2
android_external_bash-cce855bc5b117cb7ae70064131120687bc69fac0.zip
Imported from ../bash-2.02.tar.gz.
Diffstat (limited to 'hashcmd.c')
-rw-r--r--hashcmd.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/hashcmd.c b/hashcmd.c
index 381c475..5fa7b8b 100644
--- a/hashcmd.c
+++ b/hashcmd.c
@@ -31,7 +31,7 @@
#include "bashansi.h"
#include "shell.h"
-#include "execute_cmd.h"
+#include "findcmd.h"
#include "hashcmd.h"
extern int hashing_enabled;
@@ -148,9 +148,15 @@ find_hashed_filename (filename)
if (pathdata(item)->flags & (HASH_CHKDOT|HASH_RELPATH))
{
tail = (pathdata(item)->flags & HASH_RELPATH) ? path : filename;
- dotted_filename = xmalloc (3 + strlen (tail));
- dotted_filename[0] = '.'; dotted_filename[1] = '/';
- strcpy (dotted_filename + 2, tail);
+ /* If the pathname does not start with a `./', add a `./' to it. */
+ if (tail[0] != '.' || tail[1] != '/')
+ {
+ dotted_filename = xmalloc (3 + strlen (tail));
+ dotted_filename[0] = '.'; dotted_filename[1] = '/';
+ strcpy (dotted_filename + 2, tail);
+ }
+ else
+ dotted_filename = savestring (tail);
if (executable_file (dotted_filename))
return (dotted_filename);