Эх сурвалжийг харах

Add missing updwtmp() and fix broken makefile

Eric Andersen 23 жил өмнө
parent
commit
883d4fb97a

+ 2 - 2
libc/misc/utmp/Makefile

@@ -35,8 +35,8 @@ $(LIBC): ar-target
 ar-target: $(OBJS)
 	$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
 
-$(COBJS):
-	$(CC) $(CFLAGS) $< -c $*.c -o $*.o
+$(COBJS): %.o : %.c
+	$(CC) $(CFLAGS) -c $< -o $@
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 clean:

+ 12 - 0
libc/misc/utmp/utent.c

@@ -134,3 +134,15 @@ int utmpname (const char *new_ut_name)
 		close(ut_fd);
 	return 0;
 }
+
+extern void updwtmp(const char *wtmp_file, const struct utmp *ut)
+{
+	int fd;
+
+	fd = open(wtmp_file, O_APPEND | O_WRONLY, 0);
+	if (fd >= 0) {
+		write(fd, (const char *) ut, sizeof(*ut));
+		close(fd);
+	}
+}
+