public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
* [2.30 COMMITTED] login: Remove double-assignment of fl.l_whence in try_file_lock
@ 2020-01-01  0:00 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2020-01-01  0:00 UTC (permalink / raw)
  To: libc-stable

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)

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-17 14:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-01  0:00 [2.30 COMMITTED] login: Remove double-assignment of fl.l_whence in try_file_lock Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).