One more comment on this: the current solution is worse than the old behavior (a crash). Just in case you're not familiar with this, the operating system does not know about "~". If you check whether directory "~" exists in a C program, you will get a "no" answer unless there is a directory whose actual name is "~" in the current working directory. When you give commands to the shell, it translates "~" into the value of the "home" shell variable and then passes the translated value to the OS. The "home" shell variable is set by the shell at some point from the value of the HOME environment variable, which gets its value either inherited from a parent process or via a call to getpwuid. I assumed you already know this, but if you do then I don't understand why you would return "~" for the value of the home directory in path_name.c if the HOME environment variable is not set, since it can't possibly work as intended.