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