* io.c (rb_open_file): encoding in mode string was ignored if perm is
[ruby-svn.git] / sample / trojan.rb
blob3a35ac21c24cf8259196287d02c6e3def6fd1b65
1 #! /usr/local/bin/ruby
3 path = ENV['PATH'].split(File::PATH_SEPARATOR)
5 for dir in path
6   if File.directory?(dir)
7     for f in d = Dir.open(dir)
8       fpath = File.join(dir, f)  
9       if File.file?(fpath) && (File.stat(fpath).mode & 022) != 0
10         printf("file %s is writable from other users\n", fpath)
11       end
12     end
13     d.close
14   end
15 end