#### Other Tools

```/* This Source Code Form is subject to the terms of the Mozilla Public ```
``` * License, v. 2.0. If a copy of the MPL was not distributed with this ```
``` * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ ```
``` ```
```#include <stdio.h> ```
```#include <stdlib.h> ```
``` ```
```#include "nss.h" ```
```#include "secerr.h" ```
``` ```
```/* ```
``` * Regression test for bug 495097. ```
``` * ```
``` * NSS_InitReadWrite("sql:<dbdir>") should fail with SEC_ERROR_BAD_DATABASE ```
``` * if the directory <dbdir> doesn't exist. ```
``` */ ```
``` ```
```int ```
```main() ```
```{ ```
``` SECStatus status; ```
``` int error; ```
``` ```
``` status = NSS_InitReadWrite("sql:/no/such/db/dir"); ```
``` if (status == SECSuccess) { ```
``` fprintf(stderr, "NSS_InitReadWrite succeeded unexpectedly\n"); ```
``` exit(1); ```
``` } ```
``` error = PORT_GetError(); ```
``` if (error != SEC_ERROR_BAD_DATABASE) { ```
``` fprintf(stderr, "NSS_InitReadWrite failed with the wrong error code: " ```
``` "%d\n", ```
``` error); ```
``` exit(1); ```
``` } ```
``` printf("PASS\n"); ```
``` return 0; ```
```} ```
{"ft_lang_label":"__label__en","ft_lang_prob":0.59023184,"math_prob":0.42442924,"size":882,"snap":"2023-40-2023-50","text_gpt3_token_len":236,"char_repetition_ratio":0.11617312,"word_repetition_ratio":0.0,"special_character_ratio":0.30272108,"punctuation_ratio":0.20125785,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96341264,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-30T16:19:07Z\",\"WARC-Record-ID\":\"<urn:uuid:d9be84ad-6c33-4a77-b421-3c4addf7dfb2>\",\"Content-Length\":\"26723\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:36cabfcf-67da-4327-8a30-8bf4b549770b>\",\"WARC-Concurrent-To\":\"<urn:uuid:33171aba-fec5-4809-8b89-380a9a795b45>\",\"WARC-IP-Address\":\"52.33.128.193\",\"WARC-Target-URI\":\"https://searchfox.org/mozilla-central/source/security/nss/cmd/tests/baddbdir.c\",\"WARC-Payload-Digest\":\"sha1:UJZMTBYJXSUE435BLYWDOCQTQJBQ2JYY\",\"WARC-Block-Digest\":\"sha1:FIH6PX2HNATHMWE4Z7QDVDDCQOBSMXEN\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233510697.51_warc_CC-MAIN-20230930145921-20230930175921-00443.warc.gz\"}"}