From 48215018f37be88eedc5c56bf666dd2dee75d4e1 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 25 Jul 2013 18:26:22 +0200 Subject: add touch to flocker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/flocker.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/flocker.py b/src/flocker.py index 8965ee2..4503354 100644 --- a/src/flocker.py +++ b/src/flocker.py @@ -21,6 +21,12 @@ along with this program. If not, see . import fcntl +def touch(file): + file = open(file, 'a') + file.flush() + return file + + def flock(file, exclusive, nonblocking = False): locktype = (fcntl.LOCK_EX if exclusive else fcntl.LOCK_SH) | (fcntl.LOCK_NB if nonblocking else 0) fcntl(file.fileno(), locktype) -- cgit v1.2.3-70-g09d2