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