Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7560a69 authored by Chris Tate's avatar Chris Tate Committed by Android (Google) Code Review
Browse files

Merge "Fix symlink handling during backup"

parents 76ce8473 85192a1b
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -533,6 +533,14 @@ public abstract class BackupAgent extends ContextWrapper {
                File file = scanQueue.remove(0);
                String filePath;
                try {
                    // Ignore symlinks outright
                    StructStat stat = Os.lstat(file.getPath());
                    if (OsConstants.S_ISLNK(stat.st_mode)) {
                        if (DEBUG) Log.i(TAG, "Symlink (skipping)!: " + file);
                        continue;
                    }

                    // For all other verification, look at the canonicalized path
                    filePath = file.getCanonicalPath();

                    // prune this subtree?
@@ -544,11 +552,7 @@ public abstract class BackupAgent extends ContextWrapper {
                    }

                    // If it's a directory, enqueue its contents for scanning.
                    StructStat stat = Os.lstat(filePath);
                    if (OsConstants.S_ISLNK(stat.st_mode)) {
                        if (DEBUG) Log.i(TAG, "Symlink (skipping)!: " + file);
                        continue;
                    } else if (OsConstants.S_ISDIR(stat.st_mode)) {
                    if (OsConstants.S_ISDIR(stat.st_mode)) {
                        File[] contents = file.listFiles();
                        if (contents != null) {
                            for (File entry : contents) {