+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.
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;
}
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;
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 */