Re: [Circle] [Bug] file_to_string

From: George Greer (greerga@circlemud.org)
Date: 09/11/00


On Mon, 11 Sep 2000, Patrick Dughi wrote:

>    if (!feof(fl)) {
>      if (strlen(buf) + strlen(tmp) + 1 > MAX_STRING_LENGTH) {
>        log("SYSERR: %s: string too big (%d max)", name,
>                MAX_STRING_LENGTH);
>        *buf = '\0';
>        return (-1);
>      }
>      strcat(buf, tmp);
>    }
>  } while (!feof(fl));
>
>
>Shouldn't that do a fclose(fl) before return'ing (-1), just in case?

Yup.

>Though, I seriously doubt anyone's crashed over this.

It {sh,w}ouldn't crash, you'd just leak file descriptors every so often.

--
George Greer
greerga@circlemud.org


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/11/01 PDT