OSDN Git Service

Patch from Manousaridis Angelos to cleanup stale file descriptors, it was preventing...
authorGlenn L McGrath <bug1@ihug.co.nz>
Wed, 25 Aug 2004 02:02:19 +0000 (02:02 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Wed, 25 Aug 2004 02:02:19 +0000 (02:02 -0000)
loginutils/getty.c
loginutils/login.c

index 71cadc7..4d8aa9e 100644 (file)
@@ -504,7 +504,8 @@ static void update_utmp(char *line)
         * entry in the utmp file.
         */
        if (access(_PATH_UTMP, R_OK|W_OK) == -1) {
-               creat(_PATH_UTMP, 0664);
+               int fd = creat(_PATH_UTMP, 0664);
+               close(fd);
        }
        utmpname(_PATH_UTMP);
        setutent();
@@ -535,7 +536,8 @@ static void update_utmp(char *line)
 
        {
                if (access(_PATH_WTMP, R_OK|W_OK) == -1) {
-                       creat(_PATH_WTMP, 0664);
+                       int fd = creat(_PATH_WTMP, 0664);
+                       close(fd);
                }
                updwtmp(_PATH_WTMP, &ut);
        }
index f5e950f..4786d11 100644 (file)
@@ -479,7 +479,8 @@ static void setutmp(const char *name, const char *line)
        pututline(&utent);
        endutent();
        if (access(_PATH_WTMP, R_OK|W_OK) == -1) {
-               creat(_PATH_WTMP, 0664);
+               int fd = creat(_PATH_WTMP, 0664);
+               close(fd);
        }
        updwtmp(_PATH_WTMP, &utent);
 }