Apply vodz' last_patch52
[oweals/busybox.git] / libbb / libc5.c
index 20295fd4ba64476e3850754893753fe1fbf85ded..59c935e3d0cac15ce543a04d91335a8669fd3b11 100644 (file)
@@ -9,8 +9,26 @@
 #include <unistd.h>
 
 
-#if __GNU_LIBRARY__ < 5
+#if ! defined __dietlibc__ &&  __GNU_LIBRARY__ < 5
 
+/*
+ * Some systems already have updwtmp().  Some don't...  This is
+ * the updwtmp() implementation from uClibc, Copyright 2002 by
+ * Erik Andersen <andersee@debian.org> 
+ */
+extern void updwtmp(const char *wtmp_file, const struct utmp *lutmp)
+{
+       int fd;
+
+       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));
+                       lockf(fd, F_ULOCK, 0);
+                       close(fd);
+               }
+       }
+}
 
 /* Copyright (C) 1991 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
@@ -78,8 +96,7 @@ ssize_t getline(char **linebuf, size_t *n, FILE *file)
  * Copyright (c) 1991, 1993
  *     The Regents of the University of California.  All rights reserved.
  *
- * Modified for uClibc by Erik Andersen 
- *        <andersee@debian.org>, <andersen@lineo.com>
+ * Modified for uClibc by Erik Andersen <andersee@debian.org>
  *
  * The uClibc Library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public License as