The /cd command now handles getcwd() failing (eg if the current directory

has been removed).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@85 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Kevin Easton
2010-05-02 08:18:29 +00:00
parent 38cd097631
commit 1a0e5ec166
2 changed files with 7 additions and 5 deletions

View File

@@ -1,5 +1,7 @@
[Changes 1.2c01]
* Handle error return from getcwd() in /cd (caf).
* Fix alloca warnings on freebsd. (caf)
* Fix memory leak in banlist.c. (caf)

View File

@@ -5190,8 +5190,6 @@ BUILT_IN_COMMAND(cd)
*expand;
char buffer[BIG_BUFFER_SIZE + 1];
*buffer = 0;
if ((arg = new_next_arg(args, &args)) != NULL && *arg)
{
if ((expand = expand_twiddle(arg)) != NULL)
@@ -5206,12 +5204,14 @@ BUILT_IN_COMMAND(cd)
}
else
{
bitchsay("CD No such dir %s", arg);
bitchsay("CD: %s No such directory", arg);
return;
}
}
getcwd(buffer, BIG_BUFFER_SIZE);
if (getcwd(buffer, BIG_BUFFER_SIZE))
bitchsay("Current directory: %s", buffer);
else
bitchsay("CD: %s", strerror(errno));
}
BUILT_IN_COMMAND(exec_cmd)