dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
cd9c77
From ef8c8e117234f135a22ba7180114f0153b2444d8 Mon Sep 17 00:00:00 2001
cd9c77
From: Karel Zak <kzak@redhat.com>
cd9c77
Date: Mon, 20 Jun 2016 11:09:02 +0200
cd9c77
Subject: login: create /var/log/lastlog
cd9c77
cd9c77
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=151635
cd9c77
---
cd9c77
 login-utils/login.c | 2 +-
cd9c77
 1 file changed, 1 insertion(+), 1 deletion(-)
cd9c77
cd9c77
diff --git a/login-utils/login.c b/login-utils/login.c
cd9c77
index c6cd340b6..3657f04cd 100644
cd9c77
--- a/login-utils/login.c
cd9c77
+++ b/login-utils/login.c
cd9c77
@@ -662,7 +662,7 @@ static void log_lastlog(struct login_context *cxt)
cd9c77
 	sa.sa_handler = SIG_IGN;
cd9c77
 	sigaction(SIGXFSZ, &sa, &oldsa_xfsz);
cd9c77
 
cd9c77
-	fd = open(_PATH_LASTLOG, O_RDWR, 0);
cd9c77
+	fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0);
cd9c77
 	if (fd < 0)
cd9c77
 		goto done;
cd9c77
 	offset = cxt->pwd->pw_uid * sizeof(ll);
cd9c77
-- 
cd9c77
2.34.1
cd9c77