Be explicit with sticky removal, so two simultaneous processes don't create a race where sticky is left enabled.

This commit is contained in:
Mahlon E. Smith 2019-10-03 11:44:44 -07:00
parent 6602114959
commit 284cc33207
2 changed files with 5 additions and 8 deletions

View file

@ -11,10 +11,10 @@ require 'pathname'
# end # end
# #
module Ezmlm module Ezmlm
# $Id$ # $Id: ezmlm.rb,v 81cc7d47f68f 2017/05/30 18:08:48 mahlon $
# Package version # Package version
VERSION = '1.1.1' VERSION = '1.1.2'
# Suck in the components. # Suck in the components.
# #

View file

@ -1,7 +1,6 @@
#!/usr/bin/ruby #!/usr/bin/ruby
# vim: set nosta noet ts=4 sw=4: # vim: set nosta noet ts=4 sw=4:
require 'pathname' require 'pathname'
require 'time' require 'time'
require 'etc' require 'etc'
@ -14,7 +13,7 @@ require 'ezmlm' unless defined?( Ezmlm )
# #
#--- #---
class Ezmlm::List class Ezmlm::List
# $Id$ # $Id: list.rb,v a89d91d4b157 2017/06/23 17:54:26 mahlon $
# Valid subdirectories/sections for subscriptions. # Valid subdirectories/sections for subscriptions.
SUBSCRIPTION_DIRS = %w[ deny mod digest allow ] SUBSCRIPTION_DIRS = %w[ deny mod digest allow ]
@ -824,13 +823,11 @@ class Ezmlm::List
### ###
def with_safety( &block ) def with_safety( &block )
home = self.homedir home = self.homedir
mode = home.stat.mode home.chmod( home.stat.mode | 01000 ) # enable sticky
home.chmod( mode | 01000 ) # enable sticky
yield yield
ensure ensure
home.chmod( mode ) home.chmod( home.stat.mode & ~01000 ) # disable sticky
end end
end # class Ezmlm::List end # class Ezmlm::List