[Libreoffice-commits] .: sal/inc sal/osl

Michael Meeks michael at kemper.freedesktop.org
Thu Jan 19 09:04:00 PST 2012


 sal/inc/osl/detail/file.h |    6 ------
 sal/osl/unx/file_stat.cxx |   20 ++++++++++----------
 2 files changed, 10 insertions(+), 16 deletions(-)

New commits:
commit c5d4f4967e5d9d0220fadf3f313ddc35002cdf27
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Thu Jan 19 17:03:16 2012 +0000

    implement inode compare for identical directory item checking

diff --git a/sal/inc/osl/detail/file.h b/sal/inc/osl/detail/file.h
index 065c355..e6a6671 100644
--- a/sal/inc/osl/detail/file.h
+++ b/sal/inc/osl/detail/file.h
@@ -49,12 +49,6 @@ extern "C" {
 #define osl_File_OpenFlag_Trunc     0x00000010L
 #define osl_File_OpenFlag_NoExcl    0x00000020L
 
-/* Compare directory items for being the same underlying file
- * this unwinds unix hard-links and symlinks etc.
- */
-
-SAL_DLLPUBLIC sal_Bool SAL_CALL osl_identicalDirectoryItem(oslDirectory a, oslDirectory b);
-
 /*  Get the OS specific "handle" of an open file. */
 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileOSHandle(
     oslFileHandle Handle,
diff --git a/sal/osl/unx/file_stat.cxx b/sal/osl/unx/file_stat.cxx
index 320744f..e5fc091 100644
--- a/sal/osl/unx/file_stat.cxx
+++ b/sal/osl/unx/file_stat.cxx
@@ -461,17 +461,17 @@ SAL_CALL osl_identicalDirectoryItem( oslDirectoryItem a, oslDirectoryItem b)
                 pB->m_ustrFilePath->buffer, pB->m_ustrFilePath->length ) == 0)
         return sal_True;
 
-    fprintf (stderr, "We have to do an inode compare !\n");
-    /*
-    int rc = stat_c( cpFilePath, statb );
+#if defined(__GNUC__) && (__GNUC__ < 3)
+    struct ::stat a_stat, b_stat;
+#else
+    struct stat a_stat, b_stat;
+#endif
 
-        Stat.st_ino == ...
-    if (rc == -1)
-        return oslTranslateFileError(OSL_FET_ERROR, errno);
-    else
-        return osl_File_E_None;
-    */
-    return sal_False;
+    if (osl::lstat(rtl::OUString(pA->m_ustrFilePath), a_stat) != 0 ||
+        osl::lstat(rtl::OUString(pB->m_ustrFilePath), b_stat) != 0)
+        return sal_False;
+
+    return (a_stat.st_ino == b_stat.st_ino);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list