You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
7 years ago
|
diff -up util-linux-2.23.2/login-utils/login.c.kzak util-linux-2.23.2/login-utils/login.c
|
||
|
--- util-linux-2.23.2/login-utils/login.c.kzak 2015-06-24 11:03:45.123285155 +0200
|
||
|
+++ util-linux-2.23.2/login-utils/login.c 2015-06-24 11:46:19.168114438 +0200
|
||
|
@@ -495,6 +495,7 @@ static void log_audit(struct login_conte
|
||
|
|
||
|
static void log_lastlog(struct login_context *cxt)
|
||
|
{
|
||
|
+ struct sigaction sa, oldsa_xfsz;
|
||
|
struct lastlog ll;
|
||
|
time_t t;
|
||
|
int fd;
|
||
|
@@ -502,9 +503,14 @@ static void log_lastlog(struct login_con
|
||
|
if (!cxt->pwd)
|
||
|
return;
|
||
|
|
||
|
+ /* lastlog is huge on systems with large UIDs, ignore SIGXFSZ */
|
||
|
+ memset(&sa, 0, sizeof(sa));
|
||
|
+ sa.sa_handler = SIG_IGN;
|
||
|
+ sigaction(SIGXFSZ, &sa, &oldsa_xfsz);
|
||
|
+
|
||
|
fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0);
|
||
|
if (fd < 0)
|
||
|
- return;
|
||
|
+ goto done;
|
||
|
|
||
|
if (lseek(fd, (off_t) cxt->pwd->pw_uid * sizeof(ll), SEEK_SET) == -1)
|
||
|
goto done;
|
||
|
@@ -542,7 +548,10 @@ static void log_lastlog(struct login_con
|
||
|
if (write_all(fd, (char *)&ll, sizeof(ll)))
|
||
|
warn(_("write lastlog failed"));
|
||
|
done:
|
||
|
- close(fd);
|
||
|
+ if (fd >= 0)
|
||
|
+ close(fd);
|
||
|
+
|
||
|
+ sigaction(SIGXFSZ, &oldsa_xfsz, NULL); /* restore original setting */
|
||
|
}
|
||
|
|
||
|
/*
|