summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-11-07 09:53:41 +0100
committerAndreas K. Huettel <dilfridge@gentoo.org>2020-03-09 11:45:58 +0100
commit60d2de412bb15c21d312249cd34152a6db54a5c7 (patch)
tree24ea448513baf63364658a7159a93c012e0fcd0e
parentlogin: pututxline could fail to overwrite existing entries [BZ #24902] (diff)
downloadglibc-60d2de412bb15c21d312249cd34152a6db54a5c7.tar.gz
glibc-60d2de412bb15c21d312249cd34152a6db54a5c7.tar.bz2
glibc-60d2de412bb15c21d312249cd34152a6db54a5c7.zip
login: Remove double-assignment of fl.l_whence in try_file_lock
Since l_whence is the second member of struct flock, it is written twice. The double-assignment is technically undefined behavior due to the lack of a sequence point. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Change-Id: I2baf9e70690e723c61051b25ccbd510aec15976c (cherry picked from commit b0a83ae71b2588bd2a9e6b40f95191602940e01e) (cherry picked from commit 143cea84a0e23d5ba0f4e9679f59f72763b46d27)
-rw-r--r--login/utmp_file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/login/utmp_file.c b/login/utmp_file.c
index 2d0548f6fa..74ec622e96 100644
--- a/login/utmp_file.c
+++ b/login/utmp_file.c
@@ -79,7 +79,7 @@ try_file_lock (int fd, int type)
struct flock64 fl =
{
.l_type = type,
- fl.l_whence = SEEK_SET,
+ .l_whence = SEEK_SET,
};
bool status = __fcntl64_nocancel (fd, F_SETLKW, &fl) < 0;