From 536ec915d11da5089297efcbc05217d7cdc7a49b Mon Sep 17 00:00:00 2001 From: desaster Date: Fri, 20 Nov 2009 17:01:10 +0000 Subject: [PATCH] prevent rmdir of non-empty directories git-svn-id: https://kippo.googlecode.com/svn/trunk@38 951d7100-d841-11de-b865-b3884708a8e2 --- commands/base.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/commands/base.py b/commands/base.py index 1f8b17f..52f1938 100644 --- a/commands/base.py +++ b/commands/base.py @@ -93,6 +93,10 @@ class command_rmdir(HoneyPotCommand): def call(self): for f in self.args: path = self.fs.resolve_path(f, self.honeypot.cwd) + if len(self.fs.get_path(path)): + self.writeln( + 'rmdir: failed to remove `%s\': Directory not empty' % f) + continue try: dir = self.fs.get_path('/'.join(path.split('/')[:-1])) except IndexError: