Fix pwd(1) unsetting PWD and exit code.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-12-04 18:10:30 +01:00
parent 3917f4fee3
commit 99f27d5eb1
1 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2013.
Copyright(C) Jonas 'Sortie' Termansen 2013, 2014.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
@ -123,7 +123,7 @@ int main(int argc, char* argv[])
if ( const char* pwd = getenv("PWD") )
{
if ( physical || !is_path_absolute(pwd) )
unsetenv(pwd);
unsetenv("PWD");
}
char* pwd = get_current_dir_name();
@ -132,5 +132,8 @@ int main(int argc, char* argv[])
printf("%s\n", pwd);
if ( ferror(stdout) || fflush(stdout) == EOF )
error(1, errno, "stdout");
return 0;
}