Fix #15, touch crashes when trying to touch unreachable files

(by jfbethlehem)


git-svn-id: https://kippo.googlecode.com/svn/trunk@136 951d7100-d841-11de-b865-b3884708a8e2
This commit is contained in:
desaster
2010-06-18 18:29:02 +00:00
parent dbc3e1b13a
commit d95a85401b

View File

@@ -294,6 +294,11 @@ class command_touch(HoneyPotCommand):
return return
for f in self.args: for f in self.args:
path = self.fs.resolve_path(f, self.honeypot.cwd) path = self.fs.resolve_path(f, self.honeypot.cwd)
if not self.fs.exists(os.path.dirname(path)):
self.writeln(
'touch: cannot touch `%s`: no such file or directory' % \
(path))
return
if self.fs.exists(path): if self.fs.exists(path):
# FIXME: modify the timestamp here # FIXME: modify the timestamp here
continue continue