diff options
Diffstat (limited to 'libc/misc/utmp')
| -rw-r--r-- | libc/misc/utmp/Makefile | 46 | ||||
| -rw-r--r-- | libc/misc/utmp/utent.c | 22 | ||||
| -rw-r--r-- | libc/misc/utmp/wtent.c | 14 |
3 files changed, 26 insertions, 56 deletions
diff --git a/libc/misc/utmp/Makefile b/libc/misc/utmp/Makefile index c4cab9e9b..4a8f4a072 100644 --- a/libc/misc/utmp/Makefile +++ b/libc/misc/utmp/Makefile @@ -1,43 +1,13 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. -# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> +# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> # -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. - -TOPDIR=../../../ -include $(TOPDIR)Rules.mak - -CSRC=utent.c wtent.c -COBJS=$(patsubst %.c,%.o, $(CSRC)) -OBJS=$(COBJS) - -OBJ_LIST=../../obj.misc.utmp - -all: $(OBJ_LIST) - -$(OBJ_LIST): $(OBJS) - echo $(patsubst %, misc/utmp/%, $(OBJS)) > $(OBJ_LIST) - -$(COBJS): %.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - $(STRIPTOOL) -x -R .note -R .comment $*.o -clean: - $(RM) *.[oa] *~ core +top_srcdir=../../../ +top_builddir=../../../ +all: objs +include $(top_builddir)Rules.mak +include Makefile.in +include $(top_srcdir)Makerules diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index aa74cb544..c3d9ab620 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -53,7 +53,7 @@ static struct utmp *__getutent(int utmp_fd) } LOCK; - if (read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) != sizeof(struct utmp)) + if (__read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) != sizeof(struct utmp)) { return NULL; } @@ -68,8 +68,8 @@ void setutent(void) LOCK; if (static_fd == -1) { - if ((static_fd = open(static_ut_name, O_RDWR)) < 0) { - if ((static_fd = open(static_ut_name, O_RDONLY)) < 0) { + if ((static_fd = __open(static_ut_name, O_RDWR)) < 0) { + if ((static_fd = __open(static_ut_name, O_RDONLY)) < 0) { goto bummer; } } @@ -82,7 +82,7 @@ void setutent(void) bummer: UNLOCK; static_fd = -1; - close(static_fd); + __close(static_fd); return; } } @@ -95,7 +95,7 @@ void endutent(void) { LOCK; if (static_fd != -1) { - close(static_fd); + __close(static_fd); } static_fd = -1; UNLOCK; @@ -125,7 +125,7 @@ struct utmp attribute_hidden *__getutid (const struct utmp *utmp_entry) utmp_entry->ut_type == DEAD_PROCESS || utmp_entry->ut_type == LOGIN_PROCESS || utmp_entry->ut_type == USER_PROCESS) && - !strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id))) + !__strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id))) { return lutmp; } @@ -142,7 +142,7 @@ struct utmp *getutline(const struct utmp *utmp_entry) while ((lutmp = __getutent(static_fd)) != NULL) { if ((lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) && - !strcmp(lutmp->ut_line, utmp_entry->ut_line)) + !__strcmp(lutmp->ut_line, utmp_entry->ut_line)) { return lutmp; } @@ -162,11 +162,11 @@ struct utmp *pututline (const struct utmp *utmp_entry) if (__getutid(utmp_entry) != NULL) { lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR); - if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) + if (__write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) return NULL; } else { lseek(static_fd, (off_t) 0, SEEK_END); - if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) + if (__write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) return NULL; } @@ -180,7 +180,7 @@ int utmpname (const char *new_ut_name) if (new_ut_name != NULL) { if (static_ut_name != default_file_name) free((char *)static_ut_name); - static_ut_name = strdup(new_ut_name); + static_ut_name = __strdup(new_ut_name); if (static_ut_name == NULL) { /* We should probably whine about out-of-memory * errors here... Instead just reset to the default */ @@ -189,7 +189,7 @@ int utmpname (const char *new_ut_name) } if (static_fd != -1) - close(static_fd); + __close(static_fd); UNLOCK; return 0; } diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c index ef5663feb..bb5244878 100644 --- a/libc/misc/utmp/wtent.c +++ b/libc/misc/utmp/wtent.c @@ -31,13 +31,13 @@ void logwtmp (const char *line, const char *name, const char *host) { struct utmp lutmp; - memset (&(lutmp), 0, sizeof (struct utmp)); + __memset (&(lutmp), 0, sizeof (struct utmp)); lutmp.ut_type = (name && *name)? USER_PROCESS : DEAD_PROCESS; lutmp.ut_pid = getpid(); - strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1); - strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1); - strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1); + __strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1); + __strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1); + __strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1); gettimeofday(&(lutmp.ut_tv), NULL); updwtmp(_PATH_WTMP, &(lutmp)); @@ -48,12 +48,12 @@ extern void updwtmp(const char *wtmp_file, const struct utmp *lutmp) { int fd; - fd = open(wtmp_file, O_APPEND | O_WRONLY, 0); + fd = __open(wtmp_file, O_APPEND | O_WRONLY, 0); if (fd >= 0) { if (lockf(fd, F_LOCK, 0)==0) { - write(fd, (const char *) lutmp, sizeof(struct utmp)); + __write(fd, (const char *) lutmp, sizeof(struct utmp)); lockf(fd, F_ULOCK, 0); - close(fd); + __close(fd); } } } |
