Changeset 3654:9eb775ff3c55 for attach.c

Show
Ignore:
Timestamp:
2004-04-12 14:43:32 (5 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

Don't open a file for writing that we have unlinked before. Reported
embarassingly long ago by Jarno Huuskonen <Jarno.Huuskonen@…>.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • attach.c

    r3505 r3654  
    109109            goto bailout; 
    110110        } 
    111         unlink_newfile = 1; 
     111        else 
     112          unlink_newfile = 1; 
    112113      } 
    113114      else 
     
    174175            fclose (tfp); 
    175176            mutt_unlink (a->filename);   
    176             mutt_rename_file (tempfile, a->filename);  
     177            if (mutt_rename_file (tempfile, a->filename) != 0)  
     178            { 
     179              mutt_perror _("Failure to rename file."); 
     180              goto bailout; 
     181            } 
    177182 
    178183            mutt_free_body (&b); 
     
    236241            goto bailout; 
    237242        } 
    238         unlink_newfile = 1; 
     243        else 
     244          unlink_newfile = 1; 
    239245      } 
    240246      else 
     
    608614    rc = mutt_do_pager (descrip, pagerfile, 
    609615                        M_PAGER_ATTACHMENT | (is_message ? M_PAGER_MESSAGE : 0), &info); 
     616    *pagerfile = '\0'; 
    610617  } 
    611618  else