]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
AOSP: e2fsdroid: skip setting timestamp if src_dir is null
authorJin Qian <jinqian@google.com>
Tue, 2 May 2017 20:20:27 +0000 (13:20 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 24 May 2017 03:07:39 +0000 (23:07 -0400)
fs_mgr formats /data without src_dir.

Test: zero-out first 4096 bytes on /data partition and reboot
Bug: 35219933
Change-Id: I12f1eb1002fd96d18fc7a9ae5a529f673eb57273
From AOSP commit: b5330546f444b49c4d751e9ddd7677ae97161f0c

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
contrib/android/perms.c

index 1e4c6db0a48dc2579e8f84a06f83a3fc157984d9..9a7a93f5564b47003c14fb04a8a2b098b59a10f1 100644 (file)
@@ -153,11 +153,12 @@ static errcode_t set_timestamp(ext2_filsys fs, ext2_ino_t ino,
                return retval;
        }
 
-       if (params->fixed_time == -1) {
+       if (params->fixed_time == -1 && params->src_dir) {
                /* replace mountpoint from filename with src_dir */
                if (asprintf(&src_filename, "%s/%s", params->src_dir,
-                                       params->filename + strlen(params->mountpoint)) < 0)
+                       params->filename + strlen(params->mountpoint)) < 0) {
                        return -ENOMEM;
+               }
                retval = lstat(src_filename, &stat);
                if (retval < 0) {
                        com_err(__func__, retval,