tweaks: rename a variable, because nothing is returned there

master
Benno Schulenberg 2016-05-27 21:43:39 +02:00
parent 1d3d30776a
commit 3129ff687a
1 changed files with 12 additions and 11 deletions

View File

@ -655,7 +655,7 @@ void die(const char *msg, ...)
exit(1); exit(1);
} }
/* Save the current file under the name spacified in die_filename, which /* Save the current file under the name specified in die_filename, which
* is modified to be unique if necessary. */ * is modified to be unique if necessary. */
void die_save_file(const char *die_filename void die_save_file(const char *die_filename
#ifndef NANO_TINY #ifndef NANO_TINY
@ -663,7 +663,7 @@ void die_save_file(const char *die_filename
#endif #endif
) )
{ {
char *retval; char *targetname;
bool failed = TRUE; bool failed = TRUE;
/* If we're using restricted mode, don't write any emergency backup /* If we're using restricted mode, don't write any emergency backup
@ -677,14 +677,15 @@ void die_save_file(const char *die_filename
if (*die_filename == '\0') if (*die_filename == '\0')
die_filename = "nano"; die_filename = "nano";
retval = get_next_filename(die_filename, ".save"); targetname = get_next_filename(die_filename, ".save");
if (retval[0] != '\0')
failed = !write_file(retval, NULL, TRUE, OVERWRITE, TRUE); if (*targetname != '\0')
failed = !write_file(targetname, NULL, TRUE, OVERWRITE, TRUE);
if (!failed) if (!failed)
fprintf(stderr, _("\nBuffer written to %s\n"), retval); fprintf(stderr, _("\nBuffer written to %s\n"), targetname);
else if (retval[0] != '\0') else if (*targetname != '\0')
fprintf(stderr, _("\nBuffer not written to %s: %s\n"), retval, fprintf(stderr, _("\nBuffer not written to %s: %s\n"), targetname,
strerror(errno)); strerror(errno));
else else
fprintf(stderr, _("\nBuffer not written: %s\n"), fprintf(stderr, _("\nBuffer not written: %s\n"),
@ -696,14 +697,14 @@ void die_save_file(const char *die_filename
* fast as possible. */ * fast as possible. */
if (die_stat) { if (die_stat) {
int shush; int shush;
shush = chmod(retval, die_stat->st_mode); shush = chmod(targetname, die_stat->st_mode);
shush = chown(retval, die_stat->st_uid, die_stat->st_gid); shush = chown(targetname, die_stat->st_uid, die_stat->st_gid);
if (shush) if (shush)
; ;
} }
#endif #endif
free(retval); free(targetname);
} }
/* Initialize the three window portions nano uses. */ /* Initialize the three window portions nano uses. */