summaryrefslogtreecommitdiff
path: root/builtins/cd.def
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1998-07-23 14:37:54 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:52 +0000
commitbc4cd23ce958feda898c618215f94d8a4e8f4ffa (patch)
tree32fc9a13b636cb4d29873feddc533d3dfb25a917 /builtins/cd.def
parentcce855bc5b117cb7ae70064131120687bc69fac0 (diff)
downloadbash-bc4cd23ce958feda898c618215f94d8a4e8f4ffa.tar.gz
Imported from ../bash-2.02.1.tar.gz.
Diffstat (limited to 'builtins/cd.def')
-rw-r--r--builtins/cd.def8
1 files changed, 5 insertions, 3 deletions
diff --git a/builtins/cd.def b/builtins/cd.def
index ef8d8051..76ef14ba 100644
--- a/builtins/cd.def
+++ b/builtins/cd.def
@@ -263,7 +263,7 @@ cd_builtin (list)
directory name is echoed to stdout, whether or not
the shell is interactive. */
if (opt)
- printf ("%s\n", the_current_working_directory);
+ printf ("%s\n", no_symlinks ? temp : the_current_working_directory);
free (temp);
/* Posix.2 says that after using CDPATH, the resultant
@@ -276,8 +276,10 @@ cd_builtin (list)
/* POSIX.2 says that if `.' does not appear in $CDPATH, we don't
try the current directory, so we just punt now with an error
- message if POSIXLY_CORRECT is non-zero. */
- if (posixly_correct)
+ message if POSIXLY_CORRECT is non-zero. The check for cdpath[0]
+ is so we don't mistakenly treat a CDPATH value of "" as not
+ specifying the current directory. */
+ if (posixly_correct && cdpath[0])
{
builtin_error ("%s: %s", dirname, strerror (ENOENT));
return (EXECUTION_FAILURE);