Show
Ignore:
Timestamp:
2001-06-05 00:55:55 (7 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

Check mutt_create_filter*'s return value for errors. This should
avoid a bunch of possible crashes.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • commands.c

    r2406 r2435  
    125125    { 
    126126      mutt_error (_("Cannot create display filter")); 
    127       fclose (fpfilterout); 
     127      safe_fclose (&fpfilterout); 
    128128      unlink (tempfile); 
    129129      return 0; 
     
    325325#endif 
    326326 
    327     thepid = mutt_create_filter (cmd, &fpout, NULL, NULL); 
     327    if ((thepid = mutt_create_filter (cmd, &fpout, NULL, NULL)) < 0) 
     328    { 
     329      mutt_perror _("Can't create filter process"); 
     330      return 1; 
     331    } 
     332       
    328333    pipe_msg (h, fpout, decode); 
    329     fclose (fpout); 
     334    safe_fclose (&fpout); 
    330335    rc = mutt_wait_filter (thepid); 
    331336  } 
     
    359364          mutt_message_hook (Context, Context->hdrs[Context->v2r[i]], M_MESSAGEHOOK); 
    360365          mutt_endwin (NULL); 
    361           thepid = mutt_create_filter (cmd, &fpout, NULL, NULL); 
     366          if ((thepid = mutt_create_filter (cmd, &fpout, NULL, NULL)) < 0) 
     367          { 
     368            mutt_perror _("Can't create filter process"); 
     369            return 1; 
     370          } 
    362371          pipe_msg (Context->hdrs[Context->v2r[i]], fpout, decode); 
    363372          /* add the message separator */ 
    364373          if (sep)  fputs (sep, fpout); 
    365           fclose (fpout); 
     374          safe_fclose (&fpout); 
    366375          if (mutt_wait_filter (thepid) != 0) 
    367376            rc = 1; 
     
    372381    { 
    373382      mutt_endwin (NULL); 
    374       thepid = mutt_create_filter (cmd, &fpout, NULL, NULL); 
     383      if ((thepid = mutt_create_filter (cmd, &fpout, NULL, NULL)) < 0) 
     384      { 
     385        mutt_perror _("Can't create filter process"); 
     386        return 1; 
     387      } 
    375388      for (i = 0; i < Context->vcount; i++) 
    376389      { 
     
    383396        } 
    384397      } 
    385       fclose (fpout); 
     398      safe_fclose (&fpout); 
    386399      if (mutt_wait_filter (thepid) != 0) 
    387400        rc = 1;