Преглед изворни кода

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

Mike Frysinger пре 20 година
родитељ
комит
28d1fcf6a2
1 измењених фајлова са 2 додато и 2 уклоњено
  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;
 }