From 58c13fb9272b4f3eb87f260e5bcb5f817e13fb95 Mon Sep 17 00:00:00 2001 From: Alexandre Anriot Date: Wed, 12 Oct 2005 19:35:59 +0000 Subject: [PATCH] locks. --- admin/Evoauth.pl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/admin/Evoauth.pl b/admin/Evoauth.pl index 2f86551..60b8eb3 100644 --- a/admin/Evoauth.pl +++ b/admin/Evoauth.pl @@ -6,6 +6,7 @@ use strict; use warnings; use Getopt::Std; use Config::Tiny; +use Fcntl; use Evoauth::Admin; use Evoauth::Functions; @@ -44,3 +45,14 @@ sub Usage() { exit; } + +BEGIN { + sysopen(LOCK, "/tmp/evoauth.lock", O_WRONLY|O_EXCL|O_CREAT, 0644) + or die "Verouillage en cours, sortie : $!"; + + flock(LOCK, 2); +} + +END { + close (LOCK); +}