diff options
| author | jvoisin | 2013-10-05 20:46:24 +0100 |
|---|---|---|
| committer | jvoisin | 2013-10-05 20:46:24 +0100 |
| commit | f97b4d88f0254588d11b8760fc6714828af0ef28 (patch) | |
| tree | 3c53c65a86ed931041c18a9f54d0c15d56790d55 /MAT/mat.py | |
| parent | 0f2976458b4baeb418bf9242cbe7dfb96b071440 (diff) | |
mat is now able to check non-writables files
This is an implementaion of this suggestion:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=721572
Diffstat (limited to 'MAT/mat.py')
| -rw-r--r-- | MAT/mat.py | 7 |
1 files changed, 2 insertions, 5 deletions
| @@ -140,10 +140,7 @@ def create_class_file(name, backup, **kwargs): | |||
| 140 | logging.error('%s is is not readable' % name) | 140 | logging.error('%s is is not readable' % name) |
| 141 | return None | 141 | return None |
| 142 | 142 | ||
| 143 | if not os.access(name, os.W_OK): | 143 | is_writable = os.access(name, os.W_OK) |
| 144 | #check write permission | ||
| 145 | logging.error('%s is not writable' % name) | ||
| 146 | return None | ||
| 147 | 144 | ||
| 148 | if not os.path.getsize(name): | 145 | if not os.path.getsize(name): |
| 149 | #check if the file is not empty (hachoir crash on empty files) | 146 | #check if the file is not empty (hachoir crash on empty files) |
| @@ -178,4 +175,4 @@ def create_class_file(name, backup, **kwargs): | |||
| 178 | logging.info('Don\'t have stripper for %s format' % mime) | 175 | logging.info('Don\'t have stripper for %s format' % mime) |
| 179 | return None | 176 | return None |
| 180 | 177 | ||
| 181 | return stripper_class(filename, parser, mime, backup, **kwargs) | 178 | return stripper_class(filename, parser, mime, backup, is_writable, **kwargs) |
