tweaks: move a function to be before the ones that call it

This commit is contained in:
Benno Schulenberg
2020-02-02 12:14:32 +01:00
parent e877c2406e
commit 16c4f5bbd0
2 changed files with 14 additions and 12 deletions

View File

@@ -148,6 +148,17 @@ void set_modified(void)
}
#ifndef NANO_TINY
/* Delete the lockfile. Return -1 if unsuccessful, and 1 otherwise. */
int delete_lockfile(const char *lockfilename)
{
if (unlink(lockfilename) < 0 && errno != ENOENT) {
statusline(MILD, _("Error deleting lock file %s: %s"),
lockfilename, strerror(errno));
return -1;
}
return 1;
}
/* Write a lockfile, under the given lockfilename. This ALWAYS annihilates
* an existing version of that file. Return 1 on success, and 0 on failure. */
int write_lockfile(const char *lockfilename, const char *filename, bool modified)
@@ -256,17 +267,6 @@ int write_lockfile(const char *lockfilename, const char *filename, bool modified
return 1;
}
/* Delete the lockfile. Return -1 if unsuccessful, and 1 otherwise. */
int delete_lockfile(const char *lockfilename)
{
if (unlink(lockfilename) < 0 && errno != ENOENT) {
statusline(MILD, _("Error deleting lock file %s: %s"),
lockfilename, strerror(errno));
return -1;
}
return 1;
}
/* Deal with lockfiles. Return -1 on refusing to override the lockfile,
* and 1 on successfully creating it; 0 means we were not successful in
* creating the lockfile but we should continue to load the file. */