Просмотр исходного кода

Remove calls to statfs for supporting Privacy Manifests (#12355)

Sam Edson 2 лет назад
Родитель
Сommit
ec8e20eb32
2 измененных файлов с 8 добавлено и 7 удалено
  1. 3 0
      Crashlytics/CHANGELOG.md
  2. 5 7
      Crashlytics/Crashlytics/Components/FIRCLSHost.m

+ 3 - 0
Crashlytics/CHANGELOG.md

@@ -1,3 +1,6 @@
+# Unreleased
+- [changed] Removed calls to statfs in the Crashlytics SDK to comply with Apple Privacy Manifests. This change removes support for collecting Disk Space Free in Crashlytics reports.
+
 # 10.16.0
 - [fixed] Fixed a memory leak regression when generating session events (#11725).
 

+ 5 - 7
Crashlytics/Crashlytics/Components/FIRCLSHost.m

@@ -15,7 +15,6 @@
 #include "Crashlytics/Crashlytics/Components/FIRCLSHost.h"
 
 #include <mach/mach.h>
-#include <sys/mount.h>
 #include <sys/sysctl.h>
 
 #import "Crashlytics/Crashlytics/Components/FIRCLSApplication.h"
@@ -180,16 +179,15 @@ bool FIRCLSHostRecord(FIRCLSFile* file) {
 }
 
 void FIRCLSHostWriteDiskUsage(FIRCLSFile* file) {
-  struct statfs tStats;
-
   FIRCLSFileWriteSectionStart(file, "storage");
 
   FIRCLSFileWriteHashStart(file);
 
-  if (statfs(_firclsContext.readonly->host.documentDirectoryPath, &tStats) == 0) {
-    FIRCLSFileWriteHashEntryUint64(file, "free", tStats.f_bavail * tStats.f_bsize);
-    FIRCLSFileWriteHashEntryUint64(file, "total", tStats.f_blocks * tStats.f_bsize);
-  }
+  // Due to Apple Privacy Manifests, Crashlytics is not collecting
+  // disk space using statfs. When we find a solution, we can update
+  // this to actually track disk space correctly.
+  FIRCLSFileWriteHashEntryUint64(file, "free", 0);
+  FIRCLSFileWriteHashEntryUint64(file, "total", 0);
 
   FIRCLSFileWriteHashEnd(file);