NetBSD-Bugs archive

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

misc/41832: Fclose before unlock.



>Number:         41832
>Category:       misc
>Synopsis:       Fclose before unlock.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 06 17:35:00 +0000 2009
>Originator:     Henning Petersen
>Release:        
>Organization:
>Environment:
>Description:
Fclose before flock in games/dm/dm.c
>How-To-Repeat:

>Fix:
diff -u -r1.26 dm.c
--- games/dm/dm.c       20 Jul 2008 01:03:21 -0000      1.26
+++ games/dm/dm.c       6 Aug 2009 11:12:10 -0000
@@ -316,8 +316,8 @@
                else
                        fprintf(lp, "%u", uid);
                fprintf(lp, "\t%s\t%s\t%s", game, gametty, ctime(&now));
-               (void)fclose(lp);
                (void)flock(fileno(lp), LOCK_UN);
+               (void)fclose(lp);
        }
 }
 #endif /* LOG */



Home | Main Index | Thread Index | Old Index