diff --git a/adb/file_sync_client.cpp b/adb/file_sync_client.cpp index a2d2a66bf..ad3836989 100644 --- a/adb/file_sync_client.cpp +++ b/adb/file_sync_client.cpp @@ -403,9 +403,9 @@ static bool sync_recv(SyncConnection& sc, const char* rpath, const char* lpath) if (!sc.SendRequest(ID_RECV, rpath)) return false; adb_unlink(lpath); - if (!mkdirs(adb_dirname(lpath))) { - sc.Error("failed to create parent directory '%s': %s", - adb_dirname(lpath).c_str(), strerror(errno)); + const std::string dirpath = adb_dirname(lpath); + if (!mkdirs(dirpath.c_str())) { + sc.Error("failed to create parent directory '%s': %s", dirpath.c_str(), strerror(errno)); return false; }