michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include michael@0: #include michael@0: michael@0: #include "nss.h" michael@0: #include "secerr.h" michael@0: michael@0: /* michael@0: * Regression test for bug 495097. michael@0: * michael@0: * NSS_InitReadWrite("sql:") should fail with SEC_ERROR_BAD_DATABASE michael@0: * if the directory doesn't exist. michael@0: */ michael@0: michael@0: int main() michael@0: { michael@0: SECStatus status; michael@0: int error; michael@0: michael@0: status = NSS_InitReadWrite("sql:/no/such/db/dir"); michael@0: if (status == SECSuccess) { michael@0: fprintf(stderr, "NSS_InitReadWrite succeeded unexpectedly\n"); michael@0: exit(1); michael@0: } michael@0: error = PORT_GetError(); michael@0: if (error != SEC_ERROR_BAD_DATABASE) { michael@0: fprintf(stderr, "NSS_InitReadWrite failed with the wrong error code: " michael@0: "%d\n", error); michael@0: exit(1); michael@0: } michael@0: printf("PASS\n"); michael@0: return 0; michael@0: }