From 814e7256e88a1e49e1a9f6d87b809f51f92317a5 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 6 Sep 2009 04:49:40 -0700 Subject: Reordering operations to make wikilist and cgitrc races marginally less racy. --- usr/local/sbin/newrepo | 4 ++-- usr/local/sbin/rmrepo | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/usr/local/sbin/newrepo b/usr/local/sbin/newrepo index 7988117..1545f48 100755 --- a/usr/local/sbin/newrepo +++ b/usr/local/sbin/newrepo @@ -203,8 +203,8 @@ print( WIKILIST "ikiwiki-$reponame /etc/ikiwiki/piny/$reponame.setup\n" ); # In close( WIKILIST ); $wikilisttempfile = `/bin/mktemp`; chomp( $wikilisttempfile ); -system( "/bin/cat /etc/ikiwiki/wikilist.d/* > $wikilisttempfile" ); chmod ( 0644, $wikilisttempfile ); +system( "/bin/cat /etc/ikiwiki/wikilist.d/* > $wikilisttempfile" ); system( "/bin/mv $wikilisttempfile /etc/ikiwiki/wikilist" ); # This is marginally racy, but the consequences are probably ignorable. open ( CGITRC, ">/etc/cgitrc.d/$reponame" ); # Maybe someday cgit will support cgitrc.d. @@ -218,8 +218,8 @@ repo.owner=$email close( CGITRC ); $cgitrctempfile = `/bin/mktemp`; chomp( $cgitrctempfile ); -system( "/bin/cat /etc/cgitrc.d/* > $cgitrctempfile" ); chmod ( 0644, $cgitrctempfile ); +system( "/bin/cat /etc/cgitrc.d/* > $cgitrctempfile" ); system( "/bin/mv $cgitrctempfile /etc/cgitrepos" ); # This is marginally racy, but the consequences are minor. # COMPILE diff --git a/usr/local/sbin/rmrepo b/usr/local/sbin/rmrepo index 3905412..7c838ac 100755 --- a/usr/local/sbin/rmrepo +++ b/usr/local/sbin/rmrepo @@ -36,15 +36,15 @@ system( "/bin/chown -R nobody.nogroup /srv/git/$reponame.git" ); unlink( "/etc/ikiwiki/wikilist.d/$reponame" ); $wikilisttempfile = `/bin/mktemp`; chomp ( $wikilisttempfile ); -system( "/bin/cat /etc/ikiwiki/wikilist.d/* > $wikilisttempfile" ); chmod ( 0644, $wikilisttempfile ); +system( "/bin/cat /etc/ikiwiki/wikilist.d/* > $wikilisttempfile" ); system( "/bin/mv $wikilisttempfile /etc/ikiwiki/wikilist" ); # This is marginally racy, but the consequences are probably ignorable. unlink( "/etc/cgitrc.d/$reponame" ); $cgitrctempfile = `/bin/mktemp`; chomp ( $cgitrctempfile ); -system( "/bin/cat /etc/cgitrc.d/* > $cgitrctempfile" ); chmod ( 0644, $cgitrctempfile ); +system( "/bin/cat /etc/cgitrc.d/* > $cgitrctempfile" ); system( "/bin/mv $cgitrctempfile /etc/cgitrepos" ); # This is marginally racy, but the consequences are probably ignorable. system( "/bin/rm -r /srv/www/piny.svcs.cs.pdx.edu/$reponame" ); -- cgit v1.2.3