diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-05 21:29:48 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-05 21:31:23 +0200 |
commit | 27893e6651e64ad35f417ab665b8d1669fd03f61 (patch) | |
tree | 4256ca8d93b7ef98fbf86fa3bdbccab317b63cb7 /test/math/test-ifloat.c | |
parent | daaee1de182b94fa262068cd9acddec810396452 (diff) |
utent.c: fix a few bugs, and shrink a bit
bug #1:
static_fd = -1;
close(static_fd);
DOH!
bug #2:
if (utmp_fd == -1) {
__setutent();
}
if (utmp_fd == -1) {
return NULL;
}
if utmp_fd == -1, we call _setutent().
if __setutent() opens a fd, utmp_fd (a parameter)
wouldn't change, the second check is bogus.
We need to use static_fd instead in second check.
Which makes clear that having utmp_fd parameter
is wrong. See the patch for a complete fix.
Shrink comes from simplifying fcntl(static_fd, F_SETFD, FD_CLOEXEC):
text data bss dec hex filename
- 661 8 384 1053 41d libc/misc/utmp/utent.o
+ 604 8 384 996 3e4 libc/misc/utmp/utent.o
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'test/math/test-ifloat.c')
0 files changed, 0 insertions, 0 deletions