mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 06:09:38 +03:00
Not writing to stderr on magic errors, patch mostly by Mike Frysinger.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4629 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
3aea69daae
commit
bc5c7c3b74
@ -1,3 +1,12 @@
|
||||
2014-03-01 Mike Frysinger <vapier@gentoo.org>
|
||||
* src/color.c (color_update) - Do not write to stderr on magic
|
||||
errors. If the magic db has errors such that magic_load() fails,
|
||||
the current code dumps to stderr which messes up the terminal.
|
||||
The error message is also vague to the point where it's confusing
|
||||
-- I thought nano had problems writing to the file I was editing.
|
||||
Instead, use statusbar() and clarify the messages.
|
||||
(Patch tweaked by Benno.)
|
||||
|
||||
2014-02-28 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (execute_command) - Equalize pipe error messages.
|
||||
* src/global.c (thanks_for_all_the_fish) - Remove a redundant
|
||||
|
13
src/color.c
13
src/color.c
@ -160,24 +160,23 @@ void color_update(void)
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBMAGIC
|
||||
|
||||
if (strcmp(openfile->filename,"") && stat(openfile->filename, &fileinfo) == 0) {
|
||||
if (stat(openfile->filename, &fileinfo) == 0) {
|
||||
m = magic_open(MAGIC_SYMLINK |
|
||||
#ifdef DEBUG
|
||||
MAGIC_DEBUG | MAGIC_CHECK |
|
||||
#endif /* DEBUG */
|
||||
#endif
|
||||
MAGIC_ERROR);
|
||||
if (m == NULL || magic_load(m, NULL) < 0)
|
||||
fprintf(stderr, "something went wrong: %s [%s]\n", strerror(errno), openfile->filename);
|
||||
statusbar(_("magic_load() failed: %s"), strerror(errno));
|
||||
else {
|
||||
magicstring = magic_file(m,openfile->filename);
|
||||
if (magicstring == NULL) {
|
||||
magicerr = magic_error(m);
|
||||
fprintf(stderr, "something went wrong: %s [%s]\n", magicerr, openfile->filename);
|
||||
statusbar(_("magic_file(%s) failed: %s"), openfile->filename, magicerr);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "magic string returned: %s\n", magicstring);
|
||||
#endif /* DEBUG */
|
||||
fprintf(stderr, "magic string returned: %s\n", magicstring);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LIBMAGIC */
|
||||
|
Loading…
Reference in New Issue
Block a user