荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: jjk (Linux Device Driver), 信区: InstallBBS
标  题: 荔园的bbs好多地方都没用fclose
发信站: 荔园晨风BBS站 (Sat Jun  8 11:25:16 2002), 转信

发现这么多~除了有一些是quickmouse发现的, 另外还有很多,不知道还有没有。

FireBird 里面的
admintool.c文件 m_register函数
   if ((fn = fopen(genbuf, "r")) != NULL) {
     prints("\n注册资料如下:\n\n");
     for (x = 1; x <= 15; x++) {
      if (fgets(genbuf, STRLEN, fn))
       prints("%s", genbuf);
      else
       break;
     }
     fclose(fn); /* add fclose by quickmouse 01/03/09 */
   } else
Announce.c文件
 a_menusearch函数
 if (key[0] != '\0' && (fn = fopen(buf, "r")) != NULL) {
  while (fgets(buf, sizeof(buf), fn) != NULL) {
   if (searchmode && !strstr(buf, "groups/"))
    continue;
   ptr = strchr(buf, ':');
   if (!ptr) {
    fclose(fn); /* add fclose by quickmouse 01/03/09 */
    return 0;
   }
   else {
    *ptr = '\0';
    ptr = strtok(ptr + 1, " \t\n");
   }
   if (!strcasecmp(buf, key)) {
    sprintf(found, "0Announce/%s", ptr);
    flag = '1';
    break;
   }
  }
a_Import函数
if ((fn = fopen(buf, "r")) != NULL) {
        while (fgets(buf, sizeof(buf), fn) != NULL) {
         ....
        }
        fclose(fn); /* add by jjk June, 8, 2002 */
}

bbs.c文件
 getcross函数
   inf = fopen(quote_file, "r");
   of = fopen(filepath, "w");
   if (inf == NULL || of == NULL) {
    if( inf ) /* add fclose here and below by quickmouse 01/03/09 */
    {
     fclose(inf);
    }
    if( of )
    {
     fclose(of);
    }
      report("Cross Post error");
      return;
   }
add_edit_mark函数
sprintf(outname, "tmp/editpost.%s.%05d", currentuser.userid, uinfo.
pid);
        if ((out = fopen(outname, "w")) == NULL)
        {
                fclose(fp); /* add by jjk June, 8, 2002 */
                return 0;
        }
post_cross函数
        while ((fp = open(filepath, O_CREAT | O_EXCL | O_WRONLY,
0644)) == -1) {
                now++;
                sprintf(fname, "M.%d.A", now);
                setbfile(filepath, currboard, fname);
                if (count++ > MAX_POSTRETRY) {
                        (void) close(fp); /* add close by jjk June, 8,
2002 */
                        return -1;
                }
        }
cancelpost函数
                while (dashf(genbuf)) {
                        now++;
                        sprintf(fname, "M.%d.A", now);
                        setbfile(genbuf, brd, fname);
                        if (count++ > MAX_POSTRETRY) {
                                fclose(fin); /* add fclose by jjk June, 8, 2002
*/
                                return;
                        }
                }
bbsd.c文件 bad_host函数,所有在中途return的地方都没有fclose(list);

edit.c文件 keep_fail_post函数
      free(p);
      p = v;
   }
   fclose(fp); /* add by quickmouse 01/03/09 */
   return;
}

goodbye.c文件 countlogouts函数
   count++;
 }
 fclose(fp); /* add by quickmouse 01/03/09 */
 return count + 1;
}

mail.c文件
bbs_sendmail函数
 fout = popen(genbuf, "w");
 fin = fopen(fname, "r");
 if (fin == NULL || fout == NULL)
 {
     if( fin ) /* add fclose here and below by quickmouse 01/03/09 */
     {
      fclose(fin);
     }
     if( fout )
     {
      pclose(fout);
     }
  return -1;
 }

mail_file函数
       while ((fp = open(filepath, O_CREAT | O_EXCL | O_WRONLY, 0644))
== -1) {
                if (*ip == 'Z')
                        ip++, *ip = 'A', *(ip + 1) = '\0';
                else
                        (*ip)++;
                sprintf(filepath, "mail/%c/%s/%s", toupper(userid[0]),
userid, fname);
                if (count++ > MAX_POSTRETRY) {
                        close(fp); /* add close by jjk June, 8, 2002
*/
                        return -1;
                }
        }

util/local_utl/birthday.c
main函数
        if ((fp = fopen(buf, "rb")) == NULL) {
                printf("Can't open record data file.\n");
                return 1;
        }
        sprintf(buf, "%s/0Announce/bbslist/birthday", BBSHOME);
        if ((fout = fopen(buf, "w")) == NULL) {
                printf("Can't write to birthday file.\n");
                fclose(fp); /* add fclose by jjk June, 8, 2002 */
                return 1;
        }

util/mail2bbs/mail-list.c
append_mailling函数
if ( fout == NULL || fin == NULL )
           return 0;
change to
if ( fout == NULL || fin == NULL )
{
        if(fout)
                fclose(fout);
           return 0;
}

maintain.c文件 get_grp函数
   if (strlen(namep) < 30) {
    strcpy(lookgrp, namep);
    fclose(fp); /* add by quickmouse 01/03/09 */
    return 1;
   } else{
    fclose(fp); /* add by quickmouse 01/03/09 */
    return 0;
   }

register.c文件
send_regmail函数
fout = popen(genbuf, "w");
        fin = fopen(sysconf_str("EMAILFILE"), "r");
        /* add fclose and pclose here and below by jjk June, 8, 2002 */
        if (fin == NULL || fout == NULL)
        {
             if( fin )
             {
                fclose(fin);
             }
             if( fout )
             {
                pclose(fout);
             }
            return;
        }/* add end */
        if ((fin != NULL) && (fout != NULL)) {
                fprintf(fout, "Reply-To: SYSOP.bbs@%s\n", BBSHOST);
                fprintf(fout, "From: SYSOP.bbs@%s\n", BBSHOST);


util/local_utl/showperm.c
main函数
        if ((fout = fopen(buf, "w")) == NULL)
        {
                printf("can not open file showpermissions for write");
                if(fin) fclose(fin); /* add fclose by jjk June, 8, 2002 */
                return 1;
        }
--
◢   世界上最遥远的距离不是生与死而是我就站在你面前你却不知道我爱你世界上最遥远
 的距离不是我就站在你面前你却不知道我爱你而是明明知道彼此相爱却不能在一起世界上
 最遥远的距离不是明明知道彼此相爱却不能在一起而是明明无法抵挡这股想念却还得故意
 装作没有把你放在心里世界上最遥远的距离不是明明无法抵挡这股想念却还得故意装作没
 有把你放在心里而是用自己冷漠的心对爱你的人掘了一条无法跨越的沟渠……      ◤

※ 来源:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.0.146]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店