2014-07-02 Chris Allegretta <chrisa@asty.org>
* src/files.c (do_lockfile): Check whether the directory of the file we're trying to lock exists, and make the resulting error message more intuitive. Fixes Savannah bug 42639 by bens. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5056 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
637b76b582
Коммит
6d5b2fd936
@ -1,3 +1,9 @@
|
||||
2014-07-02 Chris Allegretta <chrisa@asty.org>
|
||||
* src/files.c (do_lockfile): Check whether the directory
|
||||
of the file we're trying to lock exists, and make the
|
||||
resulting error message more intuitive. Fixes
|
||||
Savannah bug 42639 by bens.
|
||||
|
||||
2014-07-02 Mark Majeres <mark@engine12.com>
|
||||
* src/text.c (undo_cut, redo_cut, update_undo): Handle the
|
||||
cases of cutting-from-cursor-to-end-of-line correctly.
|
||||
|
12
src/files.c
12
src/files.c
@ -141,7 +141,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
mypid = getpid();
|
||||
|
||||
if (gethostname(myhostname, 31) < 0) {
|
||||
statusbar(_("Couldn't determine hostname for lock file: %s"), strerror(errno));
|
||||
statusbar(_("Couldn't determine hosttname for lock file: %s"), strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -247,6 +247,7 @@ int do_lockfile(const char *filename)
|
||||
size_t lockfilesize = strlen(filename) + strlen(locking_prefix)
|
||||
+ strlen(locking_suffix) + 3;
|
||||
char *lockfilename = charalloc(lockfilesize);
|
||||
char *lockfilecpy = NULL;
|
||||
char lockprog[12], lockuser[16];
|
||||
struct stat fileinfo;
|
||||
int lockfd, lockpid;
|
||||
@ -294,8 +295,17 @@ int do_lockfile(const char *filename)
|
||||
blank_statusbar();
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
lockfilecpy = mallocstrcpy(NULL, lockfilename);
|
||||
lockfilecpy = dirname(lockfilecpy);
|
||||
if (stat(lockfilename, &fileinfo) == -1) {
|
||||
statusbar(_("Error writing lock file: Directory \'%s\' doesn't exist"),
|
||||
lockfilecpy);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return write_lockfile(lockfilename, filename, FALSE);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user