diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/check_mandirs.c | 3 | ||||
-rw-r--r-- | src/compression.c | 2 | ||||
-rw-r--r-- | src/globbing.c | 2 | ||||
-rw-r--r-- | src/man.c | 2 | ||||
-rw-r--r-- | src/mandb.c | 3 | ||||
-rw-r--r-- | src/manp.c | 1 | ||||
-rw-r--r-- | src/ult_src.c | 2 | ||||
-rw-r--r-- | src/whatis.c | 2 | ||||
-rw-r--r-- | src/zsoelim.l | 5 |
9 files changed, 22 insertions, 0 deletions
diff --git a/src/check_mandirs.c b/src/check_mandirs.c index 306c6260..f8fdad23 100644 --- a/src/check_mandirs.c +++ b/src/check_mandirs.c @@ -31,6 +31,7 @@ # include "config.h" #endif /* HAVE_CONFIG_H */ +#include <assert.h> #include <stdbool.h> #include <string.h> #include <stdlib.h> @@ -329,6 +330,7 @@ static void add_dir_entries (MYDBM_FILE dbf, const char *path, char *infile) const char *name; manpage = xasprintf ("%s/%s/", path, infile); + assert (manpage); len = strlen (manpage); /* @@ -479,6 +481,7 @@ static void fix_permissions_tree (const char *catdir) fix_permissions (catdir); catname = xasprintf ("%s/cat1", catdir); + assert (catname); for (i = 1; i <= 9; ++i) { catname[strlen (catname) - 1] = '0' + i; fix_permissions (catname); diff --git a/src/compression.c b/src/compression.c index 8c36e3fa..ecca6136 100644 --- a/src/compression.c +++ b/src/compression.c @@ -27,6 +27,7 @@ # include "config.h" #endif /* HAVE_CONFIG_H */ +#include <assert.h> #include <stdio.h> #include <errno.h> #include <signal.h> @@ -101,6 +102,7 @@ struct compression *comp_file (const char *filename) struct compression *comp; compfile = xasprintf ("%s.", filename); + assert (compfile); len = strlen (compfile); for (comp = comp_list; comp->ext; comp++) { diff --git a/src/globbing.c b/src/globbing.c index a029bea8..acf95f50 100644 --- a/src/globbing.c +++ b/src/globbing.c @@ -27,6 +27,7 @@ # include "config.h" #endif /* HAVE_CONFIG_H */ +#include <assert.h> #include <stdbool.h> #include <string.h> #include <stdlib.h> @@ -302,6 +303,7 @@ gl_list_t look_for_file (const char *hier, const char *sec, dirs = new_string_list (GL_ARRAY_LIST, false); pattern = xasprintf ("%s\t*", cat ? "cat" : "man"); + assert (pattern); *strrchr (pattern, '\t') = *sec; match_in_directory (hier, pattern, LFF_MATCHCASE, dirs); free (pattern); @@ -4264,6 +4264,7 @@ int main (int argc, char *argv[]) if (subpages && first_arg < argc) { char *subname = xasprintf ( "%s-%s", nextarg, argv[first_arg]); + assert (subname); status = man (subname, &found); free (subname); if (status == OK) { @@ -4274,6 +4275,7 @@ int main (int argc, char *argv[]) if (!found_subpage && subpages && first_arg < argc) { char *subname = xasprintf ( "%s_%s", nextarg, argv[first_arg]); + assert (subname); status = man (subname, &found); free (subname); if (status == OK) { diff --git a/src/mandb.c b/src/mandb.c index f3f6b97d..067668f5 100644 --- a/src/mandb.c +++ b/src/mandb.c @@ -462,6 +462,7 @@ static int mandb (struct dbpaths *dbpaths, int cachedir_tag_exists = 0; cachedir_tag = xasprintf ("%s/CACHEDIR.TAG", catpath); + assert (cachedir_tag); fd = open (cachedir_tag, O_RDONLY); if (fd < 0) { FILE *cachedir_tag_file; @@ -685,7 +686,9 @@ static void purge_catsubdirs (const char *manpath, const char *catpath) continue; mandir = xasprintf ("%s/man%s", manpath, ent->d_name + 3); + assert (mandir); catdir = xasprintf ("%s/%s", catpath, ent->d_name); + assert (catdir); if (stat (mandir, &st) != 0 && errno == ENOENT) { if (!quiet) @@ -295,6 +295,7 @@ static char *pathappend (char *oldpath, const char *appendage) *search = 0; newapp = xasprintf ("%s%s", app_dedup, terminator + 1); + assert (newapp); free (app_dedup); app_dedup = newapp; } diff --git a/src/ult_src.c b/src/ult_src.c index c97b5bf6..8c9ae68f 100644 --- a/src/ult_src.c +++ b/src/ult_src.c @@ -188,6 +188,7 @@ static char *find_include (const char *name, const char *path, * case it went outside the mantree. */ ret = xasprintf ("%s/%s", path, include); + assert (ret); /* If the original path from above doesn't exist, try to create new * path as if the "include" was relative to the current man page. @@ -197,6 +198,7 @@ static char *find_include (const char *name, const char *path, dirname = dir_name (name); temp_file = xasprintf ("%s/%s", dirname, include); + assert (temp_file); free (dirname); if (CAN_ACCESS (temp_file, F_OK)) { diff --git a/src/whatis.c b/src/whatis.c index c377385b..06a2cffa 100644 --- a/src/whatis.c +++ b/src/whatis.c @@ -34,6 +34,7 @@ # include "config.h" #endif /* HAVE_CONFIG_H */ +#include <assert.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> @@ -326,6 +327,7 @@ static void use_grep (const char * const *pages, int num_pages, char *manpath, bool *found) { char *whatis_file = xasprintf ("%s/whatis", manpath); + assert (whatis_file); if (CAN_ACCESS (whatis_file, R_OK)) { const char *flags; diff --git a/src/zsoelim.l b/src/zsoelim.l index d1aca19e..2c1c764e 100644 --- a/src/zsoelim.l +++ b/src/zsoelim.l @@ -57,6 +57,7 @@ #define MAX_SO_DEPTH 10 /* max .so recursion depth */ #undef ACCEPT_QUOTES /* accept quoted roff requests */ +#include <assert.h> #include <string.h> #include <stdlib.h> #include <unistd.h> @@ -405,6 +406,7 @@ int zsoelim_open_file (const char *filename, gl_list_t manpathlist, /* If there is no parent path, try opening directly first. */ if (!parent_path) { compfile = xasprintf ("%s.", filename); + assert (compfile); decomp = try_compressed (&compfile); if (decomp) { @@ -421,6 +423,7 @@ int zsoelim_open_file (const char *filename, gl_list_t manpathlist, if (parent_path) { compfile = xasprintf ("%s/%s.", parent_path, filename); + assert (compfile); decomp = try_compressed (&compfile); if (decomp) { @@ -436,6 +439,7 @@ int zsoelim_open_file (const char *filename, gl_list_t manpathlist, continue; compfile = xasprintf ("%s/%s.", mp, filename); + assert (compfile); decomp = try_compressed (&compfile); if (decomp) { @@ -503,6 +507,7 @@ int zsoelim_open_file (const char *filename, gl_list_t manpathlist, /* If there is a parent path, try opening directly last. */ if (parent_path) { compfile = xasprintf ("%s.", filename); + assert (compfile); decomp = try_compressed (&compfile); if (decomp) { |