Blob Blame History Raw
From 579c49c9ebcea62127b5c3b4ccce82b543bbea21 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 20 Jun 2016 11:09:02 +0200
Subject: login: create /var/log/lastlog

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=151635
---
 login-utils/login.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/login-utils/login.c b/login-utils/login.c
index c6cd340b6..3657f04cd 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -662,7 +662,7 @@ static void log_lastlog(struct login_context *cxt)
 	sa.sa_handler = SIG_IGN;
 	sigaction(SIGXFSZ, &sa, &oldsa_xfsz);
 
-	fd = open(_PATH_LASTLOG, O_RDWR, 0);
+	fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0);
 	if (fd < 0)
 		goto done;
 	offset = cxt->pwd->pw_uid * sizeof(ll);
-- 
2.34.1