+2014-07-11 Chris Allegretta <chrisa@asty.org>
+ * src/files.c (do_lockfile, open_file): If locking fails,
+ allow the lock failure message to be preserved AND
+ preserve the filename passed on the cmdline. Fixes
+ Savannah bug #42668.
+
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 reported by Benno Schulenberg.
+ of the file we're trying to lock exists, and make the
+ resulting error message more intuitive. Fixes
+ Savannah bug #42639 reported by Benno Schulenberg.
2014-07-02 Mark Majeres <mark@engine12.com>
* src/text.c (undo_cut, redo_cut, update_undo): Handle the
if (stat(lockfiledir, &fileinfo) == -1) {
statusbar(_("Error writing lock file: Directory \'%s\' doesn't exist"),
lockfiledir);
- return -1;
+ return 0;
}
}
int open_file(const char *filename, bool newfie, FILE **f)
{
struct stat fileinfo, fileinfo2;
- int fd;
+ int fd, quiet = 0;
char *full_filename;
assert(filename != NULL && f != NULL);
#ifndef NANO_TINY
- if (ISSET(LOCKING))
- if (do_lockfile(full_filename) < 0)
- return -1;
+ if (ISSET(LOCKING)) {
+ int lockstatus = do_lockfile(full_filename);
+ if (lockstatus < 0)
+ return -1;
+ else if (lockstatus == 0)
+ quiet = 1;
+ }
#endif
if (stat(full_filename, &fileinfo) == -1) {
/* Well, maybe we can open the file even if the OS says it's
* not there. */
if ((fd = open(filename, O_RDONLY)) != -1) {
- statusbar(_("Reading File"));
+ if (!quiet)
+ statusbar(_("Reading File"));
free(full_filename);
return 0;
}
if (newfie) {
- statusbar(_("New File"));
+ if (!quiet)
+ statusbar(_("New File"));
return -2;
}
statusbar(_("\"%s\" not found"), filename);