| @@ -1,33 +1,33 @@ | | | @@ -1,33 +1,33 @@ |
1 | /* $NetBSD: makemandb.c,v 1.32 2016/03/24 17:28:03 christos Exp $ */ | | 1 | /* $NetBSD: makemandb.c,v 1.33 2016/03/31 20:17:58 christos Exp $ */ |
2 | /* | | 2 | /* |
3 | * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com> | | 3 | * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com> |
4 | * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> | | 4 | * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
5 | * | | 5 | * |
6 | * Permission to use, copy, modify, and distribute this software for any | | 6 | * Permission to use, copy, modify, and distribute this software for any |
7 | * purpose with or without fee is hereby granted, provided that the above | | 7 | * purpose with or without fee is hereby granted, provided that the above |
8 | * copyright notice and this permission notice appear in all copies. | | 8 | * copyright notice and this permission notice appear in all copies. |
9 | * | | 9 | * |
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | | 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | | 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | | 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | | 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | | 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | | 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | */ | | 17 | */ |
18 | | | 18 | |
19 | #include <sys/cdefs.h> | | 19 | #include <sys/cdefs.h> |
20 | __RCSID("$NetBSD: makemandb.c,v 1.32 2016/03/24 17:28:03 christos Exp $"); | | 20 | __RCSID("$NetBSD: makemandb.c,v 1.33 2016/03/31 20:17:58 christos Exp $"); |
21 | | | 21 | |
22 | #include <sys/stat.h> | | 22 | #include <sys/stat.h> |
23 | #include <sys/types.h> | | 23 | #include <sys/types.h> |
24 | | | 24 | |
25 | #include <assert.h> | | 25 | #include <assert.h> |
26 | #include <dirent.h> | | 26 | #include <dirent.h> |
27 | #include <err.h> | | 27 | #include <err.h> |
28 | #include <archive.h> | | 28 | #include <archive.h> |
29 | #include <libgen.h> | | 29 | #include <libgen.h> |
30 | #include <md5.h> | | 30 | #include <md5.h> |
31 | #include <stdio.h> | | 31 | #include <stdio.h> |
32 | #include <stdlib.h> | | 32 | #include <stdlib.h> |
33 | #include <string.h> | | 33 | #include <string.h> |
| @@ -470,26 +470,27 @@ main(int argc, char *argv[]) | | | @@ -470,26 +470,27 @@ main(int argc, char *argv[]) |
470 | | | 470 | |
471 | if (mflags.verbosity) | | 471 | if (mflags.verbosity) |
472 | printf("Performing index update\n"); | | 472 | printf("Performing index update\n"); |
473 | update_db(db, mp, &rec); | | 473 | update_db(db, mp, &rec); |
474 | mparse_free(mp); | | 474 | mparse_free(mp); |
475 | mchars_free(mchars); | | 475 | mchars_free(mchars); |
476 | free_secbuffs(&rec); | | 476 | free_secbuffs(&rec); |
477 | | | 477 | |
478 | /* Commit the transaction */ | | 478 | /* Commit the transaction */ |
479 | sqlite3_exec(db, "COMMIT", NULL, NULL, &errmsg); | | 479 | sqlite3_exec(db, "COMMIT", NULL, NULL, &errmsg); |
480 | if (errmsg != NULL) { | | 480 | if (errmsg != NULL) { |
481 | warnx("%s", errmsg); | | 481 | warnx("%s", errmsg); |
482 | free(errmsg); | | 482 | free(errmsg); |
| | | 483 | close_db(db); |
483 | exit(EXIT_FAILURE); | | 484 | exit(EXIT_FAILURE); |
484 | } | | 485 | } |
485 | | | 486 | |
486 | if (mflags.optimize) | | 487 | if (mflags.optimize) |
487 | optimize(db); | | 488 | optimize(db); |
488 | | | 489 | |
489 | close_db(db); | | 490 | close_db(db); |
490 | return 0; | | 491 | return 0; |
491 | } | | 492 | } |
492 | | | 493 | |
493 | /* | | 494 | /* |
494 | * traversedir -- | | 495 | * traversedir -- |
495 | * Traverses the given directory recursively and passes all the man page files | | 496 | * Traverses the given directory recursively and passes all the man page files |