Save a line or two
authorEric Andersen <andersen@codepoet.org>
Thu, 26 Aug 2004 22:26:26 +0000 (22:26 -0000)
committerEric Andersen <andersen@codepoet.org>
Thu, 26 Aug 2004 22:26:26 +0000 (22:26 -0000)
loginutils/getty.c
loginutils/login.c

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