fix(Export internal data documents provider): Correct S_IFLNK constant and symlink detection mask (#6819)
This commit is contained in:
parent
c35b8b8e96
commit
252617b8dd
1 changed files with 6 additions and 3 deletions
|
|
@ -31,7 +31,10 @@ public class InternalDataDocumentsProvider extends DocumentsProvider {
|
|||
private static final String[] directoryColumns =
|
||||
{"document_id", "mime_type", "_display_name", "last_modified", "flags",
|
||||
"_size", "full_path", "lstat_info"};
|
||||
private static final int S_IFLNK = 0x8000;
|
||||
@SuppressWarnings("OctalInteger")
|
||||
private static final int S_IFMT = 0170000;
|
||||
@SuppressWarnings("OctalInteger")
|
||||
private static final int S_IFLNK = 0120000;
|
||||
|
||||
private String packageName;
|
||||
private File dataDirectory;
|
||||
|
|
@ -47,7 +50,7 @@ public class InternalDataDocumentsProvider extends DocumentsProvider {
|
|||
if (root.isDirectory()) {
|
||||
try {
|
||||
// Only delete recursively if the directory is not a symlink
|
||||
if ((Os.lstat(root.getPath()).st_mode & S_IFLNK) != S_IFLNK) {
|
||||
if ((Os.lstat(root.getPath()).st_mode & S_IFMT) != S_IFLNK) {
|
||||
File[] files = root.listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
|
|
@ -324,7 +327,7 @@ public class InternalDataDocumentsProvider extends DocumentsProvider {
|
|||
sb.append(";");
|
||||
sb.append(lstat.st_gid);
|
||||
// Append symlink target if it is a symlink
|
||||
if ((lstat.st_mode & S_IFLNK) == S_IFLNK) {
|
||||
if ((lstat.st_mode & S_IFMT) == S_IFLNK) {
|
||||
sb.append(";");
|
||||
sb.append(Os.readlink(path));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue