fix breakage

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3977 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2006-11-27 05:19:24 +00:00
parent 4fd1ca07a7
commit 0e48bc18be
1 changed files with 9 additions and 9 deletions

View File

@ -1275,7 +1275,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
int retval = -1; int retval = -1;
/* Instead of returning in this function, you should always /* Instead of returning in this function, you should always
* merely set retval and then goto cleanup_and_exit. */ * merely set retval and then goto cleanup_and_exit. */
size_t name_len, lineswritten = 0; size_t lineswritten = 0;
const filestruct *fileptr = openfile->fileage; const filestruct *fileptr = openfile->fileage;
int fd; int fd;
/* The file descriptor we use. */ /* The file descriptor we use. */
@ -1310,17 +1310,16 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
if (!tmp) if (!tmp)
titlebar(NULL); titlebar(NULL);
name_len = strlen(name); realname = mallocstrcpy(NULL, name);
/* Convert newlines to nulls, just before we get the real /* Convert newlines to nulls, just before we get the tilde-expanded
* filename. */ * filename. */
sunder(name); sunder(realname);
realname = real_dir_from_tilde(name); if (realname[0] == '\0')
goto cleanup_and_exit;
/* Convert nulls to newlines. name_len is the string's real realname = mallocstrassn(realname, real_dir_from_tilde(realname));
* length. */
unsunder(name, name_len);
#ifndef DISABLE_OPERATINGDIR #ifndef DISABLE_OPERATINGDIR
/* If we're writing a temporary file, we're probably going outside /* If we're writing a temporary file, we're probably going outside
@ -1703,6 +1702,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
cleanup_and_exit: cleanup_and_exit:
free(realname); free(realname);
if (tempname != NULL)
free(tempname); free(tempname);
return retval; return retval;