File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
base/cvd/cuttlefish/host/libs/image_aggregator Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ namespace {
3838
3939constexpr std::string_view kAndroidSparseImageMagic = " \x3A\xFF\x26\xED " ;
4040
41- Result<SharedFD> AcquireLock (const std::string& tmp_lock_image_path) {
41+ Result<SharedFD> AcquireLockForImage (const std::string& image_path) {
42+ std::string image_realpath;
43+ CF_EXPECT (android::base::Realpath (image_path, &image_realpath));
44+ std::string tmp_lock_image_path = image_realpath + " .lock" ;
4245 SharedFD fd =
4346 SharedFD::Open (tmp_lock_image_path.c_str (), O_RDWR | O_CREAT, 0666 );
4447 CF_EXPECTF (fd->IsOpen (), " Failed to open '{}': '{}'" , tmp_lock_image_path,
@@ -68,10 +71,10 @@ Result<bool> IsSparseImage(const std::string& image_path) {
6871}
6972
7073Result<void > ForceRawImage (const std::string& image_path) {
71- std::string tmp_lock_image_path = image_path + " .lock " ;
72-
73- SharedFD fd = CF_EXPECT ( AcquireLock (tmp_lock_image_path));
74-
74+ if (! CF_EXPECT ( IsSparseImage ( image_path))) {
75+ return {};
76+ }
77+ SharedFD fd = CF_EXPECT ( AcquireLockForImage (image_path));
7578 if (!CF_EXPECT (IsSparseImage (image_path))) {
7679 return {};
7780 }
You can’t perform that action at this time.
0 commit comments