[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] [PATCH] do not write to stderr on magic errors
From: |
Chris Allegretta |
Subject: |
Re: [Nano-devel] [PATCH] do not write to stderr on magic errors |
Date: |
Mon, 7 Jan 2013 14:42:44 -0500 |
Not ignoring this (and the other issues), just having fun with git.
On Fri, Jan 4, 2013 at 2:33 PM, Mike Frysinger <address@hidden> wrote:
> If the magic db has errors such that magic_load() fails, the current
> code dumps to stderr which messes up the ncurses terminal control.
>
> 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.
>
> Signed-off-by: Mike Frysinger <address@hidden>
> ---
> src/color.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/color.c b/src/color.c
> index e5d3348..3ddd9d6 100644
> --- a/src/color.c
> +++ b/src/color.c
> @@ -161,19 +161,19 @@ 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 */
> 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);
> --
> 1.8.0.2
>
>
> _______________________________________________
> Nano-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/nano-devel