This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[review] login: Remove double-assignment of fl.l_whence in try_file_lock
- From: "Florian Weimer (Code Review)" <gerrit at gnutoolchain-gerrit dot osci dot io>
- To: libc-alpha at sourceware dot org
- Cc: Florian Weimer <fweimer at redhat dot com>
- Date: Wed, 6 Nov 2019 16:54:52 -0500
- Subject: [review] login: Remove double-assignment of fl.l_whence in try_file_lock
- Auto-submitted: auto-generated
- References: <gerrit.1573077292000.I2baf9e70690e723c61051b25ccbd510aec15976c@gnutoolchain-gerrit.osci.io>
- Reply-to: fweimer at redhat dot com, fweimer at redhat dot com, libc-alpha at sourceware dot org
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/515
......................................................................
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.
Change-Id: I2baf9e70690e723c61051b25ccbd510aec15976c
---
M login/utmp_file.c
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/login/utmp_file.c b/login/utmp_file.c
index be7cc06..e627233 100644
--- a/login/utmp_file.c
+++ b/login/utmp_file.c
@@ -79,7 +79,7 @@
struct flock64 fl =
{
.l_type = type,
- fl.l_whence = SEEK_SET,
+ .l_whence = SEEK_SET,
};
bool status = __fcntl64_nocancel (fd, F_SETLKW, &fl) < 0;
--
Gerrit-Project: glibc
Gerrit-Branch: master
Gerrit-Change-Id: I2baf9e70690e723c61051b25ccbd510aec15976c
Gerrit-Change-Number: 515
Gerrit-PatchSet: 1
Gerrit-Owner: Florian Weimer <fweimer@redhat.com>
Gerrit-MessageType: newchange