diff options
author | robert.nagy@gmail.com <robert.nagy@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-25 19:11:59 +0000 |
---|---|---|
committer | robert.nagy@gmail.com <robert.nagy@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-25 19:11:59 +0000 |
commit | d816516f626be0f140116c609d40accb3cb54af1 (patch) | |
tree | 6b67ff2af465cd569f2b293f3887b65fd3a33692 /crypto | |
parent | 64b6509af478530b4dc8cf58dff80edd96c3df43 (diff) | |
download | chromium_src-d816516f626be0f140116c609d40accb3cb54af1.zip chromium_src-d816516f626be0f140116c609d40accb3cb54af1.tar.gz chromium_src-d816516f626be0f140116c609d40accb3cb54af1.tar.bz2 |
Implement UseLocalCacheOfNSSDatabaseIfNFS() for OpenBSD.
R=wtc@chromium.org
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/8396003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107173 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/nss_util.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc index 7a0d086..95afb54 100644 --- a/crypto/nss_util.cc +++ b/crypto/nss_util.cc @@ -16,6 +16,9 @@ #if defined(OS_LINUX) #include <linux/nfs_fs.h> #include <sys/vfs.h> +#elif defined(OS_OPENBSD) +#include <sys/mount.h> +#include <sys/param.h> #endif #include <vector> @@ -151,22 +154,27 @@ char* PKCS11PasswordFunc(PK11SlotInfo* slot, PRBool retry, void* arg) { // detection when database_dir is on NFS. See http://crbug.com/48585. // // TODO(wtc): port this function to other USE_NSS platforms. It is defined -// only for OS_LINUX simply because the statfs structure is OS-specific. +// only for OS_LINUX and OS_OPENBSD simply because the statfs structure +// is OS-specific. // // Because this function sets an environment variable it must be run before we // go multi-threaded. void UseLocalCacheOfNSSDatabaseIfNFS(const FilePath& database_dir) { -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_OPENBSD) struct statfs buf; if (statfs(database_dir.value().c_str(), &buf) == 0) { +#if defined(OS_LINUX) if (buf.f_type == NFS_SUPER_MAGIC) { +#elif defined(OS_OPENBSD) + if (strcmp(buf.f_fstypename, MOUNT_NFS) == 0) { +#endif scoped_ptr<base::Environment> env(base::Environment::Create()); const char* use_cache_env_var = "NSS_SDB_USE_CACHE"; if (!env->HasVar(use_cache_env_var)) env->SetVar(use_cache_env_var, "yes"); } } -#endif // defined(OS_LINUX) +#endif // defined(OS_LINUX) || defined(OS_OPENBSD) } PK11SlotInfo* FindSlotWithTokenName(const std::string& token_name) { |