فهرست منبع

Make login actually write out utmp and wtmp junk (even
though such things are completly unreliable crap)

Eric Andersen 21 سال پیش
والد
کامیت
efe2271a53
1فایلهای تغییر یافته به همراه13 افزوده شده و 2 حذف شده
  1. 13 2
      libutil/login.c

+ 13 - 2
libutil/login.c

@@ -8,7 +8,18 @@
 /* Write the given entry into utmp and wtmp.  */
 void login (const struct utmp *entry)
 {
-    return;
+    struct utmp copy = *entry;
+
+    utmpname(_PATH_UTMP);
+    setutent();
+#if _HAVE_UT_TYPE - 0 
+    copy.ut_type = USER_PROCESS;
+#endif  
+#if _HAVE_UT_PID - 0
+    copy.ut_pid = getpid();
+#endif
+    strncpy (copy.ut_line, entry->ut_line, UT_LINESIZE);
+    pututline(entry);
+    endutent();
 }
-link_warning (login, "the `login' function is stubbed out and will not write utmp or wtmp.")