aboutsummaryrefslogtreecommitdiffhomepage
path: root/env.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-07 21:23:12 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-07 21:23:12 -0800
commitc0e783eb6e8c12d12c9dfbc62c4d5f820e6df61d (patch)
treea7c1f4a3669bd7e69d10d802942acf888e51cfa1 /env.cpp
parent399c78fbf74f0495c6b3ffd3871356c7dfdfbb13 (diff)
Excised some halloc
Diffstat (limited to 'env.cpp')
-rw-r--r--env.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/env.cpp b/env.cpp
index b5989e7c..58a647b1 100644
--- a/env.cpp
+++ b/env.cpp
@@ -769,15 +769,12 @@ int env_set( const wchar_t *key,
if( val && contains( key, L"PWD", L"HOME" ) )
{
- void *context = halloc( 0, 0 );
- const wchar_t *val_canonical = path_make_canonical( context, val );
- if( wcscmp( val_canonical, val ) )
- {
- int res = env_set( key, val_canonical, var_mode );
- halloc_free( context );
- return res;
- }
- halloc_free( context );
+ /* Canoncalize our path; if it changes, recurse and try again. */
+ wcstring val_canonical = val;
+ path_make_canonical(val_canonical);
+ if (val != val_canonical) {
+ return env_set( key, val_canonical.c_str(), var_mode );
+ }
}
if( (var_mode & ENV_USER ) && is_read_only(key) )