
inews.c
173,179c173,181
<   extern char *optarg;
<   extern int   optind;
<   int c;
< 
<   char tempname[FILENAME_MAX];  /* temporary input file     */
<   const char *command;
<   char commandOptions[FILENAME_MAX];
---
>    extern char *optarg;
>    extern int   optind;
>    int c;
> 
>    char tempname[FILENAME_MAX];  /* temporary input file     */
>    char tempname2[FILENAME_MAX];  /* temporary output file     */
>    char buffer[256];
>    const char *command;
>    char commandOptions[FILENAME_MAX];
181,182c183,184
<   FILE *article;
<   struct stat st;
---
>    FILE *articleIn, *articleOut;
>    struct stat st;
211d212
< 
250c251,252
<   mktempname(tempname, "tmp");
---
>    mktempname(tempname, "tmp");
>    mktempname(tempname2, "tmp");
252,257c254,259
<   if ((article = FOPEN(tempname, "w", IMAGE_MODE)) == NULL)
<   {
<     printmsg(0,"inews: cannot create temporary file \"%s\"", tempname);
<     printerr( tempname );
<     panic();
<   }
---
>    if ((articleIn = FOPEN(tempname, "w+", IMAGE_MODE)) == NULL)
>    {
>       printmsg(0,"inews: cannot create temporary file in\"%s\"", tempname);
>       printerr( tempname );
>       panic();
>    }
259c261,271
<   if (complete_header(stdin, article ) == -1)
---
>    if ((articleOut = FOPEN(tempname2, "w+", IMAGE_MODE)) == NULL)
>    {
>       printmsg(0,"inews: cannot create temporary file out\"%s\"", tempname);
>       printerr( tempname2 );
>       panic();
>    }
> 
>    while(fgets(buffer, 256, stdin) != NULL)
>       fputs(buffer, articleIn);
> 
>   if (complete_header(articleIn, articleOut ) == -1)
262c274,275
<   fclose(article);
---
>   fclose(articleIn);
>   fclose(articleOut);
276,277c289,290
<    else {
< 
---
>    else
>    {
288c301
<                      tempname,
---
>                      tempname2,
304a318
>   REMOVE(tempname2);
364,374c378,386
<   if (get_header(input, buf, sizeof(buf), "Path:") == -1)
<   {
<     fprintf(output,"Path: %s\n", E_mailbox );
<   }
<   else
<      fputs( buf, output );
< 
<   if (get_header(input, buf, sizeof(buf), "From:") == -1)
<     fprintf(output,"From: %s@%s (%s)\n", E_mailbox, E_fdomain, E_name);
<   else
<     fputs(buf, output);
---
>    if (get_header(input, buf, sizeof(buf), "Path:") == -1)
>       fprintf(output,"Path: %s\n", E_mailbox );
>    else
>       fputs( buf, output );
> 
>    if (get_header(input, buf, sizeof(buf), "From:") == -1)
>       fprintf(output,"From: %s@%s (%s)\n", E_mailbox, E_fdomain, E_name);
>    else
>       fputs(buf, output);
