diff options
author | Jari Aalto <jari.aalto@cante.net> | 1997-06-05 14:59:13 +0000 |
---|---|---|
committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:50 +0000 |
commit | d166f048818e10cf3799aa24a174fb22835f1acc (patch) | |
tree | 1ca27f9243900f8b236d0cde6a3862002aea9e19 /builtins/command.def | |
parent | ccc6cda312fea9f0468ee65b8f368e9653e1380b (diff) | |
download | android_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.tar.gz android_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.tar.bz2 android_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.zip |
Imported from ../bash-2.01.tar.gz.
Diffstat (limited to 'builtins/command.def')
-rw-r--r-- | builtins/command.def | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/builtins/command.def b/builtins/command.def index 3a14dc6..6e6e5f6 100644 --- a/builtins/command.def +++ b/builtins/command.def @@ -117,13 +117,10 @@ command_builtin (list) if (use_standard_path) { old_path = get_string_value ("PATH"); + /* If old_path is NULL, $PATH is unset. If so, we want to make sure + it's unset after this command completes. */ if (old_path) old_path = savestring (old_path); - else - { - old_path = xmalloc (1); - old_path[0] = '\0'; - } add_unwind_protect ((Function *)restore_path, old_path); standard_path = get_standard_path (); @@ -162,8 +159,13 @@ static void restore_path (var) char *var; { - bind_variable ("PATH", var); - free (var); + if (var) + { + bind_variable ("PATH", var); + free (var); + } + else + unbind_variable ("PATH"); } /* Return a value for PATH that is guaranteed to find all of the standard |