From: Sebastien GODARD Date: Tue, 27 Aug 2013 19:28:33 +0000 (+0200) Subject: Fix wrong permissions for data file created by sa1 script X-Git-Tag: v10.1.7~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da83f3bd29ce04845a986b5be4b1c23a2fd20642;p=sysstat Fix wrong permissions for data file created by sa1 script If HISTORY is greater than 28, the sa1 script does not execute the command "umask 0022" until after the new output file is created, allowing it to have the wrong permissions if the root umask is not set to 0022. So move the umask command above that "if" statement. Reported-by: Peter Schiffer Signed-off-by: Sebastien GODARD --- diff --git a/sa1.in b/sa1.in index 39219f4..6c819a7 100644 --- a/sa1.in +++ b/sa1.in @@ -15,6 +15,7 @@ DATE=`date +%d` CURRENTFILE=sa${DATE} CURRENTDIR=`date +%Y%m` SYSCONFIG_DIR=@SYSCONFIG_DIR@ +umask 0022 [ -r ${SYSCONFIG_DIR}/sysstat ] && . ${SYSCONFIG_DIR}/sysstat if [ ${HISTORY} -gt 28 ] @@ -38,7 +39,7 @@ else # month then delete it so that it is recreated by sadc afresh [ -f ${CURRENTFILE} ] && [ "`date +%Y%m -r ${CURRENTFILE}`" -lt "${CURRENTDIR}" ] && rm -f ${CURRENTFILE} fi -umask 0022 + ENDIR=@SA_LIB_DIR@ cd ${ENDIR} [ "$1" = "--boot" ] && shift && BOOT=y || BOOT=n