apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tdono...@apache.org
Subject svn commit: r679652 - in /apr/apr/trunk: file_io/unix/copy.c file_io/unix/open.c file_io/win32/open.c test/testfile.c test/testfilecopy.c
Date Fri, 25 Jul 2008 03:21:54 GMT
Author: tdonovan
Date: Thu Jul 24 20:21:54 2008
New Revision: 679652

URL: http://svn.apache.org/viewvc?rev=679652&view=rev
Log:
Moved new apr_file_link() function to open.c for all platforms
Fixed args & return value for Windows.   re: PR 44841 


Modified:
    apr/apr/trunk/file_io/unix/copy.c
    apr/apr/trunk/file_io/unix/open.c
    apr/apr/trunk/file_io/win32/open.c
    apr/apr/trunk/test/testfile.c
    apr/apr/trunk/test/testfilecopy.c

Modified: apr/apr/trunk/file_io/unix/copy.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/unix/copy.c?rev=679652&r1=679651&r2=679652&view=diff
==============================================================================
--- apr/apr/trunk/file_io/unix/copy.c (original)
+++ apr/apr/trunk/file_io/unix/copy.c Thu Jul 24 20:21:54 2008
@@ -116,13 +116,3 @@
                                       perms,
                                       pool);
 }
-
-APR_DECLARE(apr_status_t) apr_file_link(const char *from_path, 
-                                          const char *to_path)
-{
-    if (link(from_path, to_path) == -1) {
-        return errno;
-    }
-
-    return APR_SUCCESS;
-}

Modified: apr/apr/trunk/file_io/unix/open.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/unix/open.c?rev=679652&r1=679651&r2=679652&view=diff
==============================================================================
--- apr/apr/trunk/file_io/unix/open.c (original)
+++ apr/apr/trunk/file_io/unix/open.c Thu Jul 24 20:21:54 2008
@@ -345,3 +345,13 @@
 }
 
 APR_POOL_IMPLEMENT_ACCESSOR(file)
+
+APR_DECLARE(apr_status_t) apr_file_link(const char *from_path, 
+                                          const char *to_path)
+{
+    if (link(from_path, to_path) == -1) {
+        return errno;
+    }
+
+    return APR_SUCCESS;
+}

Modified: apr/apr/trunk/file_io/win32/open.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/open.c?rev=679652&r1=679651&r2=679652&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/open.c (original)
+++ apr/apr/trunk/file_io/win32/open.c Thu Jul 24 20:21:54 2008
@@ -584,7 +584,7 @@
 APR_DECLARE(apr_status_t) apr_file_link(const char *from_path, 
                                            const char *to_path)
 {
-    apr_status_t rv;
+    apr_status_t rv = APR_SUCCESS;
 
 #if APR_HAS_UNICODE_FS
     IF_WIN_OS_IS_UNICODE
@@ -599,8 +599,8 @@
                                                / sizeof(apr_wchar_t), to_path))
             return rv;
 
-        if (!CreateHardLinkW(wto_path, wfrom_path))
-                return apr_get_os_error()
+        if (!CreateHardLinkW(wto_path, wfrom_path, NULL))
+                return apr_get_os_error();
     }
 #endif
 #if APR_HAS_ANSI_FS
@@ -609,6 +609,7 @@
                 return apr_get_os_error()
     }
 #endif
+    return rv;
 }
 
 APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile,

Modified: apr/apr/trunk/test/testfile.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testfile.c?rev=679652&r1=679651&r2=679652&view=diff
==============================================================================
--- apr/apr/trunk/test/testfile.c (original)
+++ apr/apr/trunk/test/testfile.c Thu Jul 24 20:21:54 2008
@@ -71,6 +71,23 @@
     apr_file_close(filetest);
 }
 
+static void link_existing(abts_case *tc, void *data)
+{
+    apr_status_t rv;
+    
+    rv = apr_file_link("data/file_datafile.txt", "data/file_datafile2.txt");
+    apr_file_remove("data/file_datafile2.txt", p);
+    ABTS_ASSERT(tc, "Couldn't create hardlink to file", rv == APR_SUCCESS);
+}
+
+static void link_nonexisting(abts_case *tc, void *data)
+{
+    apr_status_t rv;
+    
+    rv = apr_file_link("data/does_not_exist.txt", "data/fake.txt");
+    ABTS_ASSERT(tc, "", rv != APR_SUCCESS);
+}
+
 static void test_read(abts_case *tc, void *data)
 {
     apr_status_t rv;
@@ -960,6 +977,8 @@
     abts_run_test(suite, test_open_excl, NULL);
     abts_run_test(suite, test_open_read, NULL);
     abts_run_test(suite, test_open_readwrite, NULL);
+    abts_run_test(suite, link_existing, NULL);
+    abts_run_test(suite, link_nonexisting, NULL);
     abts_run_test(suite, test_read, NULL); 
     abts_run_test(suite, test_readzero, NULL); 
     abts_run_test(suite, test_seek, NULL);

Modified: apr/apr/trunk/test/testfilecopy.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testfilecopy.c?rev=679652&r1=679651&r2=679652&view=diff
==============================================================================
--- apr/apr/trunk/test/testfilecopy.c (original)
+++ apr/apr/trunk/test/testfilecopy.c Thu Jul 24 20:21:54 2008
@@ -123,23 +123,6 @@
     APR_ASSERT_SUCCESS(tc, "Couldn't remove copy file", rv);
 }
 
-static void link_existing(abts_case *tc, void *data)
-{
-    apr_status_t rv;
-    
-    rv = apr_file_link("data/file_datafile.txt", "data/file_datafile2.txt");
-    apr_file_remove("data/file_datafile2.txt", p);
-    ABTS_ASSERT(tc, "Couldn't create hardlink to file", rv == APR_SUCCESS);
-}
-
-static void link_nonexisting(abts_case *tc, void *data)
-{
-    apr_status_t rv;
-    
-    rv = apr_file_link("data/does_not_exist.txt", "data/fake.txt");
-    ABTS_ASSERT(tc, "", rv != APR_SUCCESS);
-}
-
 abts_suite *testfilecopy(abts_suite *suite)
 {
     suite = ADD_SUITE(suite)
@@ -150,9 +133,6 @@
     abts_run_test(suite, append_nonexist, NULL);
     abts_run_test(suite, append_exist, NULL);
 
-    abts_run_test(suite, link_existing, NULL);
-    abts_run_test(suite, link_nonexisting, NULL);
-
     return suite;
 }
 



Mime
View raw message