newshound Version 2.0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




This version has an error in the newshound.c file

move the 3 fclose statements inside the else condition

int check(char *server, char *group, int article)
  { /* Check to see if article is cached */
   FILE *cp, *cp_x, *cp_h;
   int result;
   char tmp[128], xtmp[128], htmp[128], bak[128], gtmp[128], *fstmp;

   strcpy(gtmp, group);
   strcpy(tmp, strtok(gtmp, "."));
   while ((fstmp = (strtok(NULL, "."))) != NULL)
     {
      strcpy(bak, tmp);
      sprintf(tmp, "%s/%s", bak, fstmp);
     }
   strcpy(bak, tmp);
   sprintf(tmp, "%s/%s/%s/%d", cachedir, server, bak, article);
   cp = fopen(tmp, "r");
   sprintf(xtmp, "%s/%s/%s/%d_xover", cachedir, server, bak, article);
   cp_x = fopen(xtmp, "r");
   sprintf(htmp, "%s/%s/%s/%d_head", cachedir, server, bak, article);
   cp_h = fopen(htmp, "r");
   if (
       ((cp == NULL) && (cp_x == NULL)) ||
       ((cp_h == NULL) && (head))
      )
     {
      result=1;
      if (debug>=3) /* This routine is called from a loop so is */
        if (head)   /* automatically a level 3 debug.           */
          printf("NH  :> %s is NOT cached\n", htmp);
        else
          printf("NH  :> %s or %s is NOT cached\n", tmp, xtmp);
     }
   else
     {
      result=0;
      if (debug>=3)
        if (head)
          printf("NH  :> %s is cached\n", htmp);
        else
          printf("NH  :> %s or %s is cached\n", tmp, xtmp);
      fclose(cp);
      fclose(cp_h);
      fclose(cp_x);
     }
   return result;
  }


Brian Moga
bmoga@junkyard.net



[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux