mirror of
https://github.com/rapid7/metasploit-payloads
synced 2024-12-21 05:35:54 +01:00
Land #27 @jlee-r7 handle broken isHidden with GCJ
This commit is contained in:
commit
d0ef907199
@ -31,7 +31,18 @@ public class stdapi_fs_stat implements Command {
|
||||
}
|
||||
|
||||
public byte[] stat(File file) throws IOException {
|
||||
int mode = (file.canRead() ? 0444 : 0) | (file.canWrite() ? 0222 : 0) | (canExecute(file) ? 0110 : 0) | (file.isHidden() ? 1 : 0) | (file.isDirectory() ? 040000 : 0) | (file.isFile() ? 0100000 : 0);
|
||||
int mode = (file.canRead() ? 0444 : 0)
|
||||
| (file.canWrite() ? 0222 : 0)
|
||||
| (canExecute(file) ? 0110 : 0)
|
||||
// File objects have a prefix (which is something like "C:\\" on Windows
|
||||
// and always "/" on Linux) and a name. If we're talking about the root
|
||||
// directory, the name will be an empty string which triggers a bug in gcj
|
||||
// where isHidden() blows up when calling charAt(0) on an empty string.
|
||||
// Work around it by always treating / as unhidden.
|
||||
| (!file.getAbsolutePath().equals("/") && file.isHidden() ? 1 : 0)
|
||||
| (file.isDirectory() ? 040000 : 0)
|
||||
| (file.isFile() ? 0100000 : 0)
|
||||
;
|
||||
return stat(mode, file.length(), file.lastModified());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user