Whamcloud - gitweb
AOSP: ext2simg: fix same_file() to check st_dev
authorEric Biggers <ebiggers@google.com>
Thu, 23 Mar 2023 00:44:21 +0000 (00:44 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 20 May 2024 16:55:23 +0000 (12:55 -0400)
commiteb6c137c51dcda142637981413e9a45da81b34e9
treef2b0838428ba3b98d7c65d739e151a17ce981c30
parente6402f03899af646016864255bf485f2994a9c2b
AOSP: ext2simg: fix same_file() to check st_dev

File identity is determined by the combination of st_dev and st_ino, not
by st_ino alone.

This fixes a bug where ext2simg would needlessly make a copy of all the
data when the input and output files happened to have the same st_ino.

Fixes: db6f320912cf ("AOSP: android: add the ext2simg tool")
Change-Id: I94e4bf57d9f91b31e5438768805e9f10bec3411d
Signed-off-by: Eric Biggers <ebiggers@google.com>
From AOSP commit: 0749f83a2cf4c134a2403701ab78388500e53f76
contrib/android/ext2simg.c