diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-05 21:29:48 +0200 |
---|---|---|
committer | Austin Foxley <austinf@cetoncorp.com> | 2009-09-18 11:08:28 -0700 |
commit | 2b5155d358188649cc7a6653b5968b514fbfe9cf (patch) | |
tree | b9991d94290b01fa7078595825056ddd437066d5 /libpthread/linuxthreads | |
parent | c3daabe3e7a11013ddb698ac94aa95299dc3ea3b (diff) | |
download | uClibc-alpine-2b5155d358188649cc7a6653b5968b514fbfe9cf.tar.bz2 uClibc-alpine-2b5155d358188649cc7a6653b5968b514fbfe9cf.tar.xz |
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>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
Diffstat (limited to 'libpthread/linuxthreads')
0 files changed, 0 insertions, 0 deletions