From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 7ED72138CE7 for ; Sat, 13 Jun 2015 04:53:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AC8ABE087D; Sat, 13 Jun 2015 04:53:44 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5EC85E087D for ; Sat, 13 Jun 2015 04:53:44 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2F9733406C0 for ; Sat, 13 Jun 2015 04:53:43 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B84FAA13 for ; Sat, 13 Jun 2015 04:53:41 +0000 (UTC) From: "Devan Franchini" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Devan Franchini" Message-ID: <1434171079.47eedeb3ec092b6916e309a36adb3e9baee4024a.twitch153@gentoo> Subject: [gentoo-commits] proj/layman:master commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/flocker.py X-VCS-Directories: layman/ X-VCS-Committer: twitch153 X-VCS-Committer-Name: Devan Franchini X-VCS-Revision: 47eedeb3ec092b6916e309a36adb3e9baee4024a X-VCS-Branch: master Date: Sat, 13 Jun 2015 04:53:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 7781fe5b-6308-4dbc-a7a1-f7dfed69951a X-Archives-Hash: a706bfc7cf8f562299027d77c22e01fd commit: 47eedeb3ec092b6916e309a36adb3e9baee4024a Author: Devan Franchini gentoo org> AuthorDate: Sat Jun 13 04:51:04 2015 +0000 Commit: Devan Franchini gentoo org> CommitDate: Sat Jun 13 04:51:19 2015 +0000 URL: https://gitweb.gentoo.org/proj/layman.git/commit/?id=47eedeb3 flocker.py: Adds file mode checking for get_file() Ensures that the file being returned by get_file() is opened with the correct mode. layman/flocker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layman/flocker.py b/layman/flocker.py index aa5f3f8..3b9df64 100644 --- a/layman/flocker.py +++ b/layman/flocker.py @@ -73,7 +73,8 @@ class FileLocker(object): if mode not in ('r', 'w+'): raise LockingException('Invalid mode %(mode)s' % {'mode': mode}) - if path not in self.files or self.files[path].closed: + if (path not in self.files or self.files[path].closed or + self.files[path].mode != mode): self.files[path] = fileopen(path, mode) f = self.files[path]