* src/buffer.c (directory_is_current_directory): Handle the case
of failed transcoding by attempting to use the non-transcoded
version. There is a high chance it is proper. Worst case it will
also fail, like the bad conversion would have prompted.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
/* Is PWD another name for `.' ? */
static int directory_is_current_directory(Extbyte * pwd)
{
/* Is PWD another name for `.' ? */
static int directory_is_current_directory(Extbyte * pwd)
{
+ Bufbyte *pwd_internal = NULL;
Bytecount pwd_internal_len;
struct stat dotstat, pwdstat;
TO_INTERNAL_FORMAT(DATA, (pwd, strlen((char *)pwd) + 1),
ALLOCA, (pwd_internal, pwd_internal_len),
Qfile_name);
Bytecount pwd_internal_len;
struct stat dotstat, pwdstat;
TO_INTERNAL_FORMAT(DATA, (pwd, strlen((char *)pwd) + 1),
ALLOCA, (pwd_internal, pwd_internal_len),
Qfile_name);
+ if( pwd_internal == NULL ) {
+ /* Failure for failure, lets try using the external
+ format anyway..
+ */
+ pwd_internal=pwd;
+
+ }
+ if( pwd_internal == NULL ) {
+ return 0;
+ }
return (IS_DIRECTORY_SEP(*pwd_internal)
&& sxemacs_stat((char *)pwd_internal, &pwdstat) == 0
&& sxemacs_stat(".", &dotstat) == 0
return (IS_DIRECTORY_SEP(*pwd_internal)
&& sxemacs_stat((char *)pwd_internal, &pwdstat) == 0
&& sxemacs_stat(".", &dotstat) == 0
{
/* This function can GC */
{
/* This function can GC */
initial_directory[0] = 0;
initial_directory[0] = 0;