d8307d
commit b0a83ae71b2588bd2a9e6b40f95191602940e01e
d8307d
Author: Florian Weimer <fweimer@redhat.com>
d8307d
Date:   Thu Nov 7 09:53:41 2019 +0100
d8307d
d8307d
    login: Remove double-assignment of fl.l_whence in try_file_lock
d8307d
    
d8307d
    Since l_whence is the second member of struct flock, it is written
d8307d
    twice.  The double-assignment is technically undefined behavior due to
d8307d
    the lack of a sequence point.
d8307d
    
d8307d
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
d8307d
    Change-Id: I2baf9e70690e723c61051b25ccbd510aec15976c
d8307d
d8307d
diff --git a/login/utmp_file.c b/login/utmp_file.c
d8307d
index cbc53d06de280af9..9ad80364682bae92 100644
d8307d
--- a/login/utmp_file.c
d8307d
+++ b/login/utmp_file.c
d8307d
@@ -79,7 +79,7 @@ try_file_lock (int fd, int type)
d8307d
  struct flock64 fl =
d8307d
    {
d8307d
     .l_type = type,
d8307d
-    fl.l_whence = SEEK_SET,
d8307d
+    .l_whence = SEEK_SET,
d8307d
    };
d8307d
 
d8307d
  bool status = __fcntl64_nocancel (fd, F_SETLKW, &fl) < 0;