diff --git a/utils/pwd.cpp b/utils/pwd.cpp index a2948a91..923152db 100644 --- a/utils/pwd.cpp +++ b/utils/pwd.cpp @@ -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; }