Title: [248702] trunk/Source/WTF
Revision
248702
Author
commit-qu...@webkit.org
Date
2019-08-14 18:58:06 -0700 (Wed, 14 Aug 2019)

Log Message

FileSystem::deleteFile should log error status (178347)
https://bugs.webkit.org/show_bug.cgi?id=178347

Patch by Kate Cheney <katherine_che...@apple.com> on 2019-08-14
Reviewed by Brent Fulgham.

I added logging to the FileSystem::deleteFile function so that the debugger will
be able to see the associated errno string and better understand the reason for an
unlink failure or will know if the fileSystemRepresentation call was not
successful (or returned null).

* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::deleteFile):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (248701 => 248702)


--- trunk/Source/WTF/ChangeLog	2019-08-15 01:17:30 UTC (rev 248701)
+++ trunk/Source/WTF/ChangeLog	2019-08-15 01:58:06 UTC (rev 248702)
@@ -1,3 +1,18 @@
+2019-08-14  Kate Cheney  <katherine_che...@apple.com>
+
+        FileSystem::deleteFile should log error status (178347)
+        https://bugs.webkit.org/show_bug.cgi?id=178347
+
+        Reviewed by Brent Fulgham.
+
+        I added logging to the FileSystem::deleteFile function so that the debugger will
+        be able to see the associated errno string and better understand the reason for an
+        unlink failure or will know if the fileSystemRepresentation call was not
+        successful (or returned null).
+
+        * wtf/posix/FileSystemPOSIX.cpp:
+        (WTF::FileSystemImpl::deleteFile):
+
 2019-08-14  Keith Rollin  <krol...@apple.com>
 
         Remove support for macOS < 10.13

Modified: trunk/Source/WTF/wtf/posix/FileSystemPOSIX.cpp (248701 => 248702)


--- trunk/Source/WTF/wtf/posix/FileSystemPOSIX.cpp	2019-08-15 01:17:30 UTC (rev 248701)
+++ trunk/Source/WTF/wtf/posix/FileSystemPOSIX.cpp	2019-08-15 01:58:06 UTC (rev 248702)
@@ -66,11 +66,17 @@
 {
     CString fsRep = fileSystemRepresentation(path);
 
-    if (!fsRep.data() || fsRep.data()[0] == '\0')
+    if (!fsRep.data() || fsRep.data()[0] == '\0') {
+        LOG_ERROR("File failed to delete. Failed to get filesystem representation to create CString from cfString or filesystem representation is a null value");
         return false;
+    }
 
     // unlink(...) returns 0 on successful deletion of the path and non-zero in any other case (including invalid permissions or non-existent file)
-    return !unlink(fsRep.data());
+    bool unlinked = !unlink(fsRep.data());
+    if (!unlinked)
+        LOG_ERROR("File failed to delete. Error message: %s", strerror(errno));
+
+    return unlinked;
 }
 
 PlatformFileHandle openFile(const String& path, FileOpenMode mode)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to