aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2009-01-20 15:55:42 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2009-01-20 15:55:42 +0000
commit9398ddb1c284e4a5fec09042959cbc3520240568 (patch)
treebfae0b2e70036b10523865f91026abbb6c7c9447
parent41c5e170269594d1ccb6f95c5a2c3bee452d077c (diff)
downloadmsec-9398ddb1c284e4a5fec09042959cbc3520240568.tar
msec-9398ddb1c284e4a5fec09042959cbc3520240568.tar.gz
msec-9398ddb1c284e4a5fec09042959cbc3520240568.tar.bz2
msec-9398ddb1c284e4a5fec09042959cbc3520240568.tar.xz
msec-9398ddb1c284e4a5fec09042959cbc3520240568.zip
Fixed detection of moved/symlinked/touched/removed files.
-rwxr-xr-xsrc/msec/libmsec.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/msec/libmsec.py b/src/msec/libmsec.py
index 89af772..46c511d 100755
--- a/src/msec/libmsec.py
+++ b/src/msec/libmsec.py
@@ -430,15 +430,6 @@ class ConfigFile:
except:
error('unlink %s: %s' % (self.path, str(sys.exc_value)))
self.log.info(_('deleted %s') % (self.path,))
- elif self.is_modified:
- content = string.join(self.lines, "\n")
- dirname = os.path.dirname(self.path)
- if not os.path.exists(dirname):
- os.makedirs(dirname)
- file = open(self.path, 'w')
- file.write(content)
- file.close()
- self.meta.modified(self.path)
elif self.is_touched:
if os.path.exists(self.path):
try:
@@ -477,11 +468,19 @@ class ConfigFile:
except:
self.log.error('symlink %s %s: %s' % (self.sym_link, self.path, str(sys.exc_value)))
self.log.info(_('made symbolic link from %s to %s') % (self.sym_link, self.path))
-
- if self.is_moved:
+ elif self.is_moved:
move(self.path, self.path + self.suffix)
self.log.info(_('moved file %s to %s') % (self.path, self.path + self.suffix))
self.meta.modified(self.path)
+ elif self.is_modified:
+ content = string.join(self.lines, "\n")
+ dirname = os.path.dirname(self.path)
+ if not os.path.exists(dirname):
+ os.makedirs(dirname)
+ file = open(self.path, 'w')
+ file.write(content)
+ file.close()
+ self.meta.modified(self.path)
self.is_touched = 0
self.is_modified = 0
self.is_deleted = 0