OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 #include <stdio.h> | 5 #include <stdio.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "nss.h" | 8 #include "nss.h" |
9 #include "secerr.h" | 9 #include "secerr.h" |
10 | 10 |
11 /* | 11 /* |
12 * Regression test for bug 495097. | 12 * Regression test for bug 495097. |
13 * | 13 * |
14 * NSS_InitReadWrite("sql:<dbdir>") should fail with SEC_ERROR_BAD_DATABASE | 14 * NSS_InitReadWrite("sql:<dbdir>") should fail with SEC_ERROR_BAD_DATABASE |
15 * if the directory <dbdir> doesn't exist. | 15 * if the directory <dbdir> doesn't exist. |
16 */ | 16 */ |
17 | 17 |
18 int main() | 18 int main() { |
19 { | 19 SECStatus status; |
20 SECStatus status; | 20 int error; |
21 int error; | |
22 | 21 |
23 status = NSS_InitReadWrite("sql:/no/such/db/dir"); | 22 status = NSS_InitReadWrite("sql:/no/such/db/dir"); |
24 if (status == SECSuccess) { | 23 if (status == SECSuccess) { |
25 fprintf(stderr, "NSS_InitReadWrite succeeded unexpectedly\n"); | 24 fprintf(stderr, "NSS_InitReadWrite succeeded unexpectedly\n"); |
26 exit(1); | 25 exit(1); |
27 } | 26 } |
28 error = PORT_GetError(); | 27 error = PORT_GetError(); |
29 if (error != SEC_ERROR_BAD_DATABASE) { | 28 if (error != SEC_ERROR_BAD_DATABASE) { |
30 fprintf(stderr, "NSS_InitReadWrite failed with the wrong error code: " | 29 fprintf(stderr, |
31 "%d\n", error); | 30 "NSS_InitReadWrite failed with the wrong error code: " |
32 exit(1); | 31 "%d\n", |
33 } | 32 error); |
34 printf("PASS\n"); | 33 exit(1); |
35 return 0; | 34 } |
| 35 printf("PASS\n"); |
| 36 return 0; |
36 } | 37 } |
OLD | NEW |