Browse Source

make sure we reset static_fd after it's closed in utmpname()

Mike Frysinger 18 years ago
parent
commit
28d1fcf6a2
1 changed files with 2 additions and 2 deletions
  1. 2 2
      libc/misc/utmp/utent.c

+ 2 - 2
libc/misc/utmp/utent.c

@@ -100,9 +100,8 @@ static struct utmp *__getutent(int utmp_fd)
 void endutent(void)
 {
     LOCK;
-    if (static_fd != -1) {
+    if (static_fd != -1)
 	close(static_fd);
-    }
     static_fd = -1;
     UNLOCK;
 }
@@ -192,6 +191,7 @@ int utmpname (const char *new_ut_name)
 
     if (static_fd != -1)
 	close(static_fd);
+    static_fd = -1;
     UNLOCK;
     return 0;
 }