From b61941996224f3b9314973ef52b413dcc916f74d Mon Sep 17 00:00:00 2001 From: Glenn L McGrath Date: Wed, 25 Aug 2004 02:02:19 +0000 Subject: [PATCH] Patch from Manousaridis Angelos to cleanup stale file descriptors, it was preventing unmounting an initial filesystem. --- loginutils/getty.c | 6 ++++-- loginutils/login.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/loginutils/getty.c b/loginutils/getty.c index 71cadc7ab..4d8aa9e31 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c @@ -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); } diff --git a/loginutils/login.c b/loginutils/login.c index f5e950f58..4786d117d 100644 --- a/loginutils/login.c +++ b/loginutils/login.c @@ -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); }