]> git.sur5r.net Git - openldap/commitdiff
ITS#7682 F_NOCACHE: Allow error, skip any O_DIRECT
authorHallvard Furuseth <hallvard@openldap.org>
Tue, 6 Sep 2016 15:41:02 +0000 (17:41 +0200)
committerHallvard Furuseth <hallvard@openldap.org>
Sun, 25 Sep 2016 06:12:56 +0000 (08:12 +0200)
We can run without F_NOCACHE if it fails. And we do not know
what combining it with O_DIRECT means, if a system has both.

libraries/liblmdb/mdb.c

index b0518a55620a4b04aa4b18a1a3cc3c0eca86a824..ecfd5cab66c80ae45c2ff3aec4f0c6b244c88107 100644 (file)
@@ -10169,17 +10169,12 @@ mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags)
        }
 
        if (env->me_psize >= env->me_os_psize) {
-#ifdef O_DIRECT
+#ifdef F_NOCACHE       /* __APPLE__ */
+       (void) fcntl(newfd, F_NOCACHE, 1);
+#elif defined O_DIRECT
        /* Set O_DIRECT if the file system supports it */
        if ((rc = fcntl(newfd, F_GETFL)) != -1)
                (void) fcntl(newfd, F_SETFL, rc | O_DIRECT);
-#endif
-#ifdef F_NOCACHE       /* __APPLE__ */
-       rc = fcntl(newfd, F_NOCACHE, 1);
-       if (rc) {
-               rc = ErrCode();
-               goto leave;
-       }
 #endif
        }