From patchwork Wed Nov 6 21:54:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 35706 Received: (qmail 63111 invoked by alias); 6 Nov 2019 21:54:57 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 63101 invoked by uid 89); 6 Nov 2019 21:54:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: mx1.osci.io X-Gerrit-PatchSet: 1 Date: Wed, 6 Nov 2019 16:54:52 -0500 From: "Florian Weimer (Code Review)" To: libc-alpha@sourceware.org Cc: Florian Weimer Message-ID: Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange Subject: [review] login: Remove double-assignment of fl.l_whence in try_file_lock X-Gerrit-Change-Id: I2baf9e70690e723c61051b25ccbd510aec15976c X-Gerrit-Change-Number: 515 X-Gerrit-ChangeURL: X-Gerrit-Commit: 2741b1f25a51597995b861e00ca5a76cade297f5 References: Reply-To: fweimer@redhat.com, fweimer@redhat.com, libc-alpha@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-75-g9005159e5d 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 Reviewed-by: Carlos O'Donell --- 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;