files: when the buffer is nameless, include the PID in name of dump file
Make sure that when multiple nanos with nameless buffers die, each of them tries saving those buffers to different files. This addresses https://savannah.gnu.org/bugs/?60902. Reported-by: Julian Rosen <julianrosen@gmail.com>
Этот коммит содержится в:
родитель
806e8e439f
Коммит
e3ef778756
10
src/nano.c
10
src/nano.c
@ -309,15 +309,17 @@ void do_exit(void)
|
||||
statusbar(_("Cancelled"));
|
||||
}
|
||||
|
||||
/* Save the current buffer under the given name (or under the name "nano"
|
||||
/* Save the current buffer under the given name (or under "nano.<PID>"
|
||||
* for a nameless buffer). If needed, the name is modified to be unique. */
|
||||
void emergency_save(const char *plainname)
|
||||
void emergency_save(char *plainname)
|
||||
{
|
||||
bool saved = FALSE;
|
||||
char *targetname;
|
||||
|
||||
if (*plainname == '\0')
|
||||
plainname = "nano";
|
||||
if (*plainname == '\0') {
|
||||
plainname = nrealloc(plainname, 28);
|
||||
sprintf(plainname, "nano.%u", getpid());
|
||||
}
|
||||
|
||||
targetname = get_next_filename(plainname, ".save");
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user