X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/19304f7c526fbe36ba0db2fb80bcaf3bd974d81d..24d1372aec0208946117089a703451c458a4c09a:/main.c?ds=inline diff --git a/main.c b/main.c index 25fc33d..baea582 100644 --- a/main.c +++ b/main.c @@ -78,7 +78,7 @@ Copyright (C) 1998-2005 Werner Koch \n\ Copyright (C) 1999-2009 Brendan Cully \n\ Copyright (C) 1999-2002 Tommi Komulainen \n\ Copyright (C) 2000-2002 Edmund Grimley Evans \n\ -Copyright (C) 2006-2008 Rocco Rutte \n\ +Copyright (C) 2006-2009 Rocco Rutte \n\ \n\ Many others not mentioned here contributed code, fixes,\n\ and suggestions.\n"); @@ -631,7 +631,11 @@ int main (int argc, char **argv) case 'd': #ifdef DEBUG - debuglevel = atoi (optarg); + if (mutt_atoi (optarg, &debuglevel) < 0 || debuglevel <= 0) + { + fprintf (stderr, _("Error: value '%s' is invalid for -d.\n"), optarg); + return 1; + } printf (_("Debugging at level %d.\n"), debuglevel); #else printf _("DEBUG was not defined during compilation. Ignored.\n"); @@ -741,6 +745,9 @@ int main (int argc, char **argv) /* Initialize crypto backends. */ crypt_init (); + if (newMagic) + mx_set_magic (newMagic); + if (queries) { for (; optind < argc; optind++) @@ -773,9 +780,6 @@ int main (int argc, char **argv) return rv; } - if (newMagic) - mx_set_magic (newMagic); - if (!option (OPTNOCURSES)) { SETCOLOR (MT_COLOR_NORMAL); @@ -909,7 +913,7 @@ int main (int argc, char **argv) if (!option (OPTNOCURSES)) mutt_endwin (NULL); perror (tempfile); - fclose (fin); + safe_fclose (&fin); FREE (&tempfile); exit (1); } @@ -917,9 +921,9 @@ int main (int argc, char **argv) mutt_copy_stream (fin, fout); else if (bodytext) fputs (bodytext, fout); - fclose (fout); + safe_fclose (&fout); if (fin && fin != stdin) - fclose (fin); + safe_fclose (&fin); } }