Re: missing fclose someplace?

From: Robert Sinland (rsinland@ERSKINE.POLARISTEL.NET)
Date: 10/23/97


Erwin S. Andreasen wrote:
>

> Alternatively, if using Linux, you can look in /proc/<pid>/fd/ - the files
> there will be symlinks (well, kind of) to the files open; you cannot see
> the names but you can see device number : inode number (and can use a
> 'find' to find the file). A bit more costly, lsof does something like this
> much faster :)
>
  Thanks, that worked :)  Tracked the problem down to mutiple open
room-save files.  My hunch is it's in this code chunk someplace.

void save_saved(int i)
{
  char buf[MAX_STRING_LENGTH];
  FILE *fll;

  if (i == -1)
    return;

   sprintf(buf, "save/%d.save", i);
   fopen(buf, "wb");
   fclose(fll);

   fll = fopen(buf, "wb");

   save_save(world[i].contents, fll);

  fclose(fll);
  save_restore_weight(world[i].contents);


}
Gets the files opened, does the write, but never closes again...
eventually I run out of file handles (or whatever) and can't save or
open any more files.
RS


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



This archive was generated by hypermail 2b30 : 12/08/00 PST