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:
@@ -1,5 +1,7 @@
|
|||||||
[Changes 1.2c01]
|
[Changes 1.2c01]
|
||||||
|
|
||||||
|
* Handle error return from getcwd() in /cd (caf).
|
||||||
|
|
||||||
* Fix alloca warnings on freebsd. (caf)
|
* Fix alloca warnings on freebsd. (caf)
|
||||||
|
|
||||||
* Fix memory leak in banlist.c. (caf)
|
* Fix memory leak in banlist.c. (caf)
|
||||||
|
|||||||
@@ -5190,8 +5190,6 @@ BUILT_IN_COMMAND(cd)
|
|||||||
*expand;
|
*expand;
|
||||||
char buffer[BIG_BUFFER_SIZE + 1];
|
char buffer[BIG_BUFFER_SIZE + 1];
|
||||||
|
|
||||||
|
|
||||||
*buffer = 0;
|
|
||||||
if ((arg = new_next_arg(args, &args)) != NULL && *arg)
|
if ((arg = new_next_arg(args, &args)) != NULL && *arg)
|
||||||
{
|
{
|
||||||
if ((expand = expand_twiddle(arg)) != NULL)
|
if ((expand = expand_twiddle(arg)) != NULL)
|
||||||
@@ -5206,12 +5204,14 @@ BUILT_IN_COMMAND(cd)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bitchsay("CD No such dir %s", arg);
|
bitchsay("CD: %s No such directory", arg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getcwd(buffer, BIG_BUFFER_SIZE);
|
if (getcwd(buffer, BIG_BUFFER_SIZE))
|
||||||
bitchsay("Current directory: %s", buffer);
|
bitchsay("Current directory: %s", buffer);
|
||||||
|
else
|
||||||
|
bitchsay("CD: %s", strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
BUILT_IN_COMMAND(exec_cmd)
|
BUILT_IN_COMMAND(exec_cmd)
|
||||||
|
|||||||
Reference in New Issue
Block a user