X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fexicyclog.src;h=c491b205b6f7cadaa86fabaf93b32966ad5cbf9b;hb=ab6f5da3dfe80ed83827fd2f9e3e72c86d103649;hp=3d67ee9f06b9fca5f4d976ab320fc1059b42ccc3;hpb=0a49a7a4f1090b6f1ce1d0f9d969804c9226b53e;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/exicyclog.src b/src/src/exicyclog.src index 3d67ee9f0..c491b205b 100644 --- a/src/src/exicyclog.src +++ b/src/src/exicyclog.src @@ -1,7 +1,6 @@ #! /bin/sh -# $Cambridge: exim/src/src/exicyclog.src,v 1.11 2009/11/16 19:50:36 nm4 Exp $ -# Copyright (c) University of Cambridge, 1995 - 2007 +# Copyright (c) University of Cambridge, 1995 - 2015 # See the file NOTICE for conditions of use and distribution. # This script takes the following command line arguments: @@ -283,28 +282,34 @@ done if [ $keep -gt 99 ]; then first=001; else first=01; fi +# Grab our pid ro avoid race in file creation +ourpid=$$ + if [ -f $mainlog ]; then $mv $mainlog $mainlog.$first $chown $user:$group $mainlog.$first - $touch $mainlog - $chown $user:$group $mainlog - $chmod 640 $mainlog + $touch $mainlog.$ourpid + $chown $user:$group $mainlog.$ourpid + $chmod 640 $mainlog.$ourpid + $mv $mainlog.$ourpid $mainlog fi if [ -f $rejectlog ]; then $mv $rejectlog $rejectlog.$first $chown $user:$group $rejectlog.$first - $touch $rejectlog - $chown $user:$group $rejectlog - $chmod 640 $rejectlog + $touch $rejectlog.$ourpid + $chown $user:$group $rejectlog.$ourpid + $chmod 640 $rejectlog.$ourpid + $mv $rejectlog.$ourpid $rejectlog fi if [ -f $paniclog ]; then $mv $paniclog $paniclog.$first $chown $user:$group $paniclog.$first - $touch $paniclog - $chown $user:$group $paniclog - $chmod 640 $paniclog + $touch $paniclog.$ourpid + $chown $user:$group $paniclog.$ourpid + $chmod 640 $paniclog.$ourpid + $mv $paniclog.$ourpid $paniclog fi # Now scan the (0)02 and later files, compressing where necessary, and