TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Unclosed file handles in /map map

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
skleinjung



Joined: 07 Jan 2009
Posts: 1

PostPosted: Wed Jan 07, 2009 3:48 am    Post subject: Unclosed file handles in /map map Reply with quote

If you use the "/map map" command to write the map out to a file, the file handle is not closed after the map is saved. I wrote a trigger to save the map image to a file every time a new room is loaded (so that an external process could display it). This trigger causes TinTin to run out of file handles rather quickly, however. Once this happens, attempting to use /write or "/map write" generates a generic error message stating that the file could not be opened for writing.

This can be fixed for most cases by changing line 1764 of mapper.c from "fflush(logfile);" to "fclose(logfile);". This will close the file once the map is rendered to it, instead of just flushing the buffer.

Because the file is opened so early in the show_map() function, there are probably many scenarios where an error or other unusual event could cause this function to return without properly closing the file handle. However, for the nominal case where there are no errors, this fix is a vast improvement over the current behavior (which never closes the file handles at all).

Thanks,
Sean Kleinjung
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3796

PostPosted: Wed Jan 07, 2009 9:34 am    Post subject: Reply with quote

Thanks for letting me know. Other than a crash nothing will stop the function from executing till it gets to line 1764, so your fix solves this bug. Smile
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group