d2bdca
diff -up util-linux-2.23.2/login-utils/login.c.kzak util-linux-2.23.2/login-utils/login.c
d2bdca
--- util-linux-2.23.2/login-utils/login.c.kzak	2015-06-24 11:03:45.123285155 +0200
d2bdca
+++ util-linux-2.23.2/login-utils/login.c	2015-06-24 11:46:19.168114438 +0200
d2bdca
@@ -495,6 +495,7 @@ static void log_audit(struct login_conte
d2bdca
 
d2bdca
 static void log_lastlog(struct login_context *cxt)
d2bdca
 {
d2bdca
+	struct sigaction sa, oldsa_xfsz;
d2bdca
 	struct lastlog ll;
d2bdca
 	time_t t;
d2bdca
 	int fd;
d2bdca
@@ -502,9 +503,14 @@ static void log_lastlog(struct login_con
d2bdca
 	if (!cxt->pwd)
d2bdca
 		return;
d2bdca
 
d2bdca
+	/* lastlog is huge on systems with large UIDs, ignore SIGXFSZ */
d2bdca
+	memset(&sa, 0, sizeof(sa));
d2bdca
+	sa.sa_handler = SIG_IGN;
d2bdca
+	sigaction(SIGXFSZ, &sa, &oldsa_xfsz);
d2bdca
+
d2bdca
 	fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0);
d2bdca
 	if (fd < 0)
d2bdca
-		return;
d2bdca
+		goto done;
d2bdca
 
d2bdca
 	if (lseek(fd, (off_t) cxt->pwd->pw_uid * sizeof(ll), SEEK_SET) == -1)
d2bdca
 		goto done;
d2bdca
@@ -542,7 +548,10 @@ static void log_lastlog(struct login_con
d2bdca
 	if (write_all(fd, (char *)&ll, sizeof(ll)))
d2bdca
 		warn(_("write lastlog failed"));
d2bdca
 done:
d2bdca
-	close(fd);
d2bdca
+	if (fd >= 0)
d2bdca
+		close(fd);
d2bdca
+
d2bdca
+	sigaction(SIGXFSZ, &oldsa_xfsz, NULL);		/* restore original setting */
d2bdca
 }
d2bdca
 
d2bdca
 /*