about summary refs log tree commit diff
path: root/login
diff options
context:
space:
mode:
Diffstat (limited to 'login')
-rw-r--r--login/logout.c9
-rw-r--r--login/logwtmp.c9
-rw-r--r--login/utmp.h7
3 files changed, 17 insertions, 8 deletions
diff --git a/login/logout.c b/login/logout.c
index d47a392699..1b8dc317ff 100644
--- a/login/logout.c
+++ b/login/logout.c
@@ -41,15 +41,16 @@ logout (const char *line)
 #if _HAVE_UT_TYPE - 0
   tmp.ut_type = USER_PROCESS;
 #endif
-  strncpy (tmp.ut_line, line, UT_LINESIZE);
+  strncpy (tmp.ut_line, line, sizeof tmp.ut_line);
 
   /* Read the record.  */
   if (getutline_r (&tmp, &ut, &data) >= 0 || errno == ESRCH)
     {
       /* Clear information about who & from where.  */
-      bzero (ut->ut_name, UT_NAMESIZE);
-      bzero (ut->ut_host, UT_HOSTSIZE);
-
+      bzero (ut->ut_name, sizeof ut->ut_name);
+#if _HAVE_UT_HOST - 0
+      bzero (ut->ut_host, sizeof ut->ut_host);
+#endif
 #if _HAVE_UT_TV - 0
       gettimeofday (&ut->ut_tv, NULL);
 #else
diff --git a/login/logwtmp.c b/login/logwtmp.c
index 10f7384f6c..371f34ee76 100644
--- a/login/logwtmp.c
+++ b/login/logwtmp.c
@@ -45,9 +45,11 @@ logwtmp (const char *line, const char *name, const char *host)
 #if _HAVE_UT_TYPE - 0
   ut.ut_type = USER_PROCESS;
 #endif
-  strncpy (ut.ut_line, line, UT_LINESIZE);
-  strncpy (ut.ut_name, name, UT_NAMESIZE);
-  strncpy (ut.ut_host, host, UT_HOSTSIZE);
+  strncpy (ut.ut_line, line, sizeof ut.ut_line);
+  strncpy (ut.ut_name, name, sizeof ut.ut_name);
+#if _HAVE_UT_HOST - 0
+  strncpy (ut.ut_host, host, sizeof ut.ut_host);
+#endif
 
 #if _HAVE_UT_TV - 0
   gettimeofday (&ut.ut_tv, NULL);
@@ -60,5 +62,4 @@ logwtmp (const char *line, const char *name, const char *host)
 
   /* Close UTMP file.  */
   endutent_r (&data);
-
 }
diff --git a/login/utmp.h b/login/utmp.h
index 71f1a093df..e9c1734258 100644
--- a/login/utmp.h
+++ b/login/utmp.h
@@ -28,6 +28,13 @@ Boston, MA 02111-1307, USA.  */
 /* Get system dependent values and data structures.  */
 #include <utmpbits.h>
 
+/* Compatibility names for the strings of the canonical file names.  */
+#define UTMP_FILE	_PATH_UTMP
+#define UTMP_FILENAME	_PATH_UTMP
+#define WTMP_FILE	_PATH_WTMP
+#define WTMP_FILENAME	_PATH_WTMP
+
+
 
 /* Make FD be the controlling terminal, stdin, stdout, and stderr;
    then close FD.  Returns 0 on success, nonzero on error.  */