diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2004-08-25 02:02:19 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2004-08-25 02:02:19 +0000 |
commit | b61941996224f3b9314973ef52b413dcc916f74d (patch) | |
tree | 864d8f56be7bd356e209d4f1b2261b03ffdfef18 | |
parent | a4d27d2d385db205a9e6a0983985e02085f910ef (diff) | |
download | busybox-w32-b61941996224f3b9314973ef52b413dcc916f74d.tar.gz busybox-w32-b61941996224f3b9314973ef52b413dcc916f74d.tar.bz2 busybox-w32-b61941996224f3b9314973ef52b413dcc916f74d.zip |
Patch from Manousaridis Angelos to cleanup stale file descriptors, it was preventing unmounting an initial filesystem.
-rw-r--r-- | loginutils/getty.c | 6 | ||||
-rw-r--r-- | 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) | |||
504 | * entry in the utmp file. | 504 | * entry in the utmp file. |
505 | */ | 505 | */ |
506 | if (access(_PATH_UTMP, R_OK|W_OK) == -1) { | 506 | if (access(_PATH_UTMP, R_OK|W_OK) == -1) { |
507 | creat(_PATH_UTMP, 0664); | 507 | int fd = creat(_PATH_UTMP, 0664); |
508 | close(fd); | ||
508 | } | 509 | } |
509 | utmpname(_PATH_UTMP); | 510 | utmpname(_PATH_UTMP); |
510 | setutent(); | 511 | setutent(); |
@@ -535,7 +536,8 @@ static void update_utmp(char *line) | |||
535 | 536 | ||
536 | { | 537 | { |
537 | if (access(_PATH_WTMP, R_OK|W_OK) == -1) { | 538 | if (access(_PATH_WTMP, R_OK|W_OK) == -1) { |
538 | creat(_PATH_WTMP, 0664); | 539 | int fd = creat(_PATH_WTMP, 0664); |
540 | close(fd); | ||
539 | } | 541 | } |
540 | updwtmp(_PATH_WTMP, &ut); | 542 | updwtmp(_PATH_WTMP, &ut); |
541 | } | 543 | } |
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) | |||
479 | pututline(&utent); | 479 | pututline(&utent); |
480 | endutent(); | 480 | endutent(); |
481 | if (access(_PATH_WTMP, R_OK|W_OK) == -1) { | 481 | if (access(_PATH_WTMP, R_OK|W_OK) == -1) { |
482 | creat(_PATH_WTMP, 0664); | 482 | int fd = creat(_PATH_WTMP, 0664); |
483 | close(fd); | ||
483 | } | 484 | } |
484 | updwtmp(_PATH_WTMP, &utent); | 485 | updwtmp(_PATH_WTMP, &utent); |
485 | } | 486 | } |