+2009-11-19 Chris Allegretta <chrisa@asty.org>
+ * nano.c (die_save_file) Try nd match the permissions of the file we were
+ editing but only make a minimal effort to do so. Fixes Savannah bug 27273
+ reported by Mike Frysinger.
+
2009-11-18 Adrian Bunk <bunk via Savannah>
- * nano.c (main) - Allow --fill and --nowrap to override nanorc entries and each other
+ * nano.c (main): Allow --fill and --nowrap to override nanorc entries and each other
on the command line.
2009-11-15 Chris Allegretta <chrisa@asty.org>
if (filepart != NULL)
unpartition_filestruct(&filepart);
- die_save_file(openfile->filename);
+ die_save_file(openfile->filename, openfile->current_stat);
}
#ifdef ENABLE_MULTIBUFFER
/* Save the current file buffer if it's been modified. */
if (openfile->modified)
- die_save_file(openfile->filename);
+ die_save_file(openfile->filename, openfile->current_stat);
}
}
#endif
/* Save the current file under the name spacified in die_filename, which
* is modified to be unique if necessary. */
-void die_save_file(const char *die_filename)
+void die_save_file(const char *die_filename, struct stat *die_stat)
{
char *retval;
bool failed = TRUE;
fprintf(stderr, _("\nBuffer not written: %s\n"),
_("Too many backup files?"));
+ /* Try and chmod/chown the save file to the values of the original file, but
+ dont worry if it fails because we're supposed to be bailing as fast
+ as possible. */
+ if (die_stat) {
+ int shush;
+ shush = chmod(retval, die_stat->st_mode);
+ shush = chown(retval, die_stat->st_uid, die_stat->st_gid);
+ }
+
free(retval);
}
void print_view_warning(void);
void finish(void);
void die(const char *msg, ...);
-void die_save_file(const char *die_filename);
+void die_save_file(const char *die_filename, struct stat *die_stat);
void window_init(void);
#ifndef DISABLE_MOUSE
void disable_mouse_support(void);