Prechádzať zdrojové kódy

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

Mike Frysinger 19 rokov pred
rodič
commit
28d1fcf6a2
1 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  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)
 void endutent(void)
 {
 {
     LOCK;
     LOCK;
-    if (static_fd != -1) {
+    if (static_fd != -1)
 	close(static_fd);
 	close(static_fd);
-    }
     static_fd = -1;
     static_fd = -1;
     UNLOCK;
     UNLOCK;
 }
 }
@@ -192,6 +191,7 @@ int utmpname (const char *new_ut_name)
 
 
     if (static_fd != -1)
     if (static_fd != -1)
 	close(static_fd);
 	close(static_fd);
+    static_fd = -1;
     UNLOCK;
     UNLOCK;
     return 0;
     return 0;
 }
 }