statusbar: add a non-beeping message type that does not get overwritten

Error messages about lock files should not get overwritten by purely
informational messages, only by alerting ones.

This fixes https://savannah.gnu.org/bugs/?47963.
This commit is contained in:
Benno Schulenberg
2016-05-19 20:43:08 +02:00
parent c9d1936f02
commit c8f530af93
8 changed files with 35 additions and 32 deletions

View File

@@ -184,7 +184,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
* old state. */
myuid = geteuid();
if ((mypwuid = getpwuid(myuid)) == NULL) {
statusline(ALERT, _("Couldn't determine my identity for lock file "
statusline(MILD, _("Couldn't determine my identity for lock file "
"(getpwuid() failed)"));
goto free_and_fail;
}
@@ -194,7 +194,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
if (errno == ENAMETOOLONG)
myhostname[31] = '\0';
else {
statusline(ALERT, _("Couldn't determine hostname for lock file: %s"),
statusline(MILD, _("Couldn't determine hostname for lock file: %s"),
strerror(errno));
goto free_and_fail;
}
@@ -216,7 +216,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
/* Maybe we just don't have write access. Print an error message
* and continue. */
if (fd < 0) {
statusline(ALERT, _("Error writing lock file %s: %s"),
statusline(MILD, _("Error writing lock file %s: %s"),
lockfilename, strerror(errno));
free(lockdata);
return 0;
@@ -227,7 +227,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
filestream = fdopen(fd, "wb");
if (fd < 0 || filestream == NULL) {
statusline(ALERT, _("Error writing lock file %s: %s"), lockfilename,
statusline(MILD, _("Error writing lock file %s: %s"), lockfilename,
strerror(errno));
goto free_and_fail;
}
@@ -264,7 +264,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
wroteamt = fwrite(lockdata, sizeof(char), lockdatalen, filestream);
if (wroteamt < lockdatalen) {
statusline(ALERT, _("Error writing lock file %s: %s"),
statusline(MILD, _("Error writing lock file %s: %s"),
lockfilename, ferror(filestream));
goto free_and_fail;
}
@@ -274,7 +274,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
#endif
if (fclose(filestream) == EOF) {
statusline(ALERT, _("Error writing lock file %s: %s"),
statusline(MILD, _("Error writing lock file %s: %s"),
lockfilename, strerror(errno));
goto free_and_fail;
}
@@ -294,7 +294,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
int delete_lockfile(const char *lockfilename)
{
if (unlink(lockfilename) < 0 && errno != ENOENT) {
statusline(ALERT, _("Error deleting lock file %s: %s"), lockfilename,
statusline(MILD, _("Error deleting lock file %s: %s"), lockfilename,
strerror(errno));
return -1;
}
@@ -329,7 +329,7 @@ int do_lockfile(const char *filename)
int room, ans;
if ((lockfd = open(lockfilename, O_RDONLY)) < 0) {
statusline(ALERT, _("Error opening lock file %s: %s"),
statusline(MILD, _("Error opening lock file %s: %s"),
lockfilename, strerror(errno));
goto free_the_name;
}
@@ -341,7 +341,7 @@ int do_lockfile(const char *filename)
} while (readamt > 0 && readtot < LOCKBUFSIZE);
if (readtot < 48) {
statusline(ALERT, _("Error reading lock file %s: "
statusline(MILD, _("Error reading lock file %s: "
"Not enough data read"), lockfilename);
free(lockbuf);
goto free_the_name;