Blame SOURCES/nss-softokn-fs-probe.patch

70d46f
# HG changeset patch
70d46f
# User David Keeler <dkeeler@mozilla.com>
70d46f
# Date 1500978196 -7200
70d46f
#      Tue Jul 25 12:23:16 2017 +0200
70d46f
# Node ID 9c94423e0669decabbb22b0d52ce31115c750265
70d46f
# Parent  f212be04f3d0265340bf5ae20ffbbccdda68b0aa
70d46f
bug 1382736 - Don't perform costly filesystem probes at startup r=ttaubert
70d46f
70d46f
Differential Revision: https://nss-review.dev.mozaws.net/D374
70d46f
70d46f
diff --git a/lib/softoken/sdb.c b/lib/softoken/sdb.c
70d46f
--- a/lib/softoken/sdb.c
70d46f
+++ b/lib/softoken/sdb.c
70d46f
@@ -1866,30 +1866,29 @@ sdb_init(char *dbname, char *table, sdbD
70d46f
      * so we use it for the cache (see sdb_buildCache for how it's done).*/
70d46f
 
70d46f
     /*
70d46f
-      * we decide whether or not to use the cache based on the following input.
70d46f
-      *
70d46f
-      * NSS_SDB_USE_CACHE environment variable is non-existant or set to
70d46f
-      *   anything other than "no" or "yes" ("auto", for instance).
70d46f
-      *   This is the normal case. NSS will measure the performance of access
70d46f
-      *   to the temp database versus the access to the users passed in
70d46f
-      *   database location. If the temp database location is "significantly"
70d46f
-      *   faster we will use the cache.
70d46f
-      *
70d46f
-      * NSS_SDB_USE_CACHE environment variable is set to "no": cache will not
70d46f
-      *   be used.
70d46f
-      *
70d46f
-      * NSS_SDB_USE_CACHE environment variable is set to "yes": cache will
70d46f
-      *   always be used.
70d46f
-      *
70d46f
-      * It is expected that most applications would use the "auto" selection,
70d46f
-      * the environment variable is primarily to simplify testing, and to
70d46f
-      * correct potential corner cases where  */
70d46f
+     * we decide whether or not to use the cache based on the following input.
70d46f
+     *
70d46f
+     * NSS_SDB_USE_CACHE environment variable is set to anything other than
70d46f
+     *   "yes" or "no" (for instance, "auto"): NSS will measure the performance
70d46f
+     *   of access to the temp database versus the access to the user's
70d46f
+     *   passed-in database location. If the temp database location is
70d46f
+     *   "significantly" faster we will use the cache.
70d46f
+     *
70d46f
+     * NSS_SDB_USE_CACHE environment variable is nonexistent or set to "no":
70d46f
+     *   cache will not be used.
70d46f
+     *
70d46f
+     * NSS_SDB_USE_CACHE environment variable is set to "yes": cache will
70d46f
+     *   always be used.
70d46f
+     *
70d46f
+     * It is expected that most applications will not need this feature, and
70d46f
+     * thus it is disabled by default.
70d46f
+     */
70d46f
 
70d46f
     env = PR_GetEnvSecure("NSS_SDB_USE_CACHE");
70d46f
 
70d46f
-    if (env && PORT_Strcasecmp(env, "no") == 0) {
70d46f
+    if (!env || PORT_Strcasecmp(env, "no") == 0) {
70d46f
         enableCache = PR_FALSE;
70d46f
-    } else if (env && PORT_Strcasecmp(env, "yes") == 0) {
70d46f
+    } else if (PORT_Strcasecmp(env, "yes") == 0) {
70d46f
         enableCache = PR_TRUE;
70d46f
     } else {
70d46f
         char *tempDir = NULL;
70d46f
@@ -2035,10 +2034,11 @@ s_open(const char *directory, const char
70d46f
     {
70d46f
         char *env;
70d46f
         env = PR_GetEnvSecure("NSS_SDB_USE_CACHE");
70d46f
-        /* If the environment variable is set to yes or no, sdb_init() will
70d46f
-         * ignore the value of accessOps, and we can skip the measuring.*/
70d46f
-        if (!env || ((PORT_Strcasecmp(env, "no") != 0) &&
70d46f
-                     (PORT_Strcasecmp(env, "yes") != 0))) {
70d46f
+        /* If the environment variable is undefined or set to yes or no,
70d46f
+         * sdb_init() will ignore the value of accessOps, and we can skip the
70d46f
+         * measuring.*/
70d46f
+        if (env && PORT_Strcasecmp(env, "no") != 0 &&
70d46f
+            PORT_Strcasecmp(env, "yes") != 0) {
70d46f
             accessOps = sdb_measureAccess(directory);
70d46f
         }
70d46f
     }