diff options
-rw-r--r-- | libq/contents.c | 1 | ||||
-rw-r--r-- | libq/xpak.c | 2 | ||||
-rw-r--r-- | libq/xsystem.c | 7 | ||||
-rw-r--r-- | main.c | 4 | ||||
-rw-r--r-- | main.h | 1 | ||||
-rw-r--r-- | q.c | 1 | ||||
-rw-r--r-- | qcache.c | 2 | ||||
-rw-r--r-- | qgrep.c | 15 | ||||
-rw-r--r-- | qlop.c | 1 | ||||
-rw-r--r-- | qmerge.c | 10 | ||||
-rw-r--r-- | qpkg.c | 4 | ||||
-rw-r--r-- | qsearch.c | 1 | ||||
-rw-r--r-- | qtegrity.c | 3 | ||||
-rw-r--r-- | quse.c | 1 |
14 files changed, 35 insertions, 18 deletions
diff --git a/libq/contents.c b/libq/contents.c index 41929d0..3e719a6 100644 --- a/libq/contents.c +++ b/libq/contents.c @@ -11,6 +11,7 @@ #include <stdlib.h> #include <string.h> +#include <limits.h> #include "contents.h" diff --git a/libq/xpak.c b/libq/xpak.c index 09b58bd..2785899 100644 --- a/libq/xpak.c +++ b/libq/xpak.c @@ -258,7 +258,7 @@ _xpak_add_file( /* the xpak format can only store files whose size is a 32bit int * so we have to make sure we don't store a big file */ if (in_len != st->st_size) { - warnf("File is too big: %"PRIu64, (uint64_t)st->st_size); + warnf("File is too big: %zu", (size_t)st->st_size); fclose(fin); goto fake_data_len; } diff --git a/libq/xsystem.c b/libq/xsystem.c index 1cc5cad..e11172e 100644 --- a/libq/xsystem.c +++ b/libq/xsystem.c @@ -6,12 +6,15 @@ */ #include "main.h" -#include "xasprintf.h" -#include "xsystem.h" #include <stdlib.h> #include <sys/wait.h> #include <fcntl.h> +#include <sys/types.h> +#include <unistd.h> + +#include "xasprintf.h" +#include "xsystem.h" void xsystem(const char *command) { @@ -448,7 +448,7 @@ read_portage_env_file(const char *configroot, const char *file, env_vars vars[]) if ((dentslen = scandir(buf, &dents, NULL, alphasort)) > 0) { int di; struct dirent *d; - char npath[_Q_PATH_MAX]; + char npath[_Q_PATH_MAX * 2]; /* recurse through all files */ for (di = 0; di < dentslen; di++) { @@ -858,7 +858,7 @@ initialize_flat(const char *overlay, int cache_type, bool force) if (pkg_cnt < 0) continue; for (c = 0; c < pkg_cnt; c++) { - char de[_Q_PATH_MAX]; + char de[_Q_PATH_MAX * 2]; snprintf(de, sizeof(de), "%s/%s", category[i]->d_name, pn[c]->d_name); @@ -15,6 +15,7 @@ #endif #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <errno.h> #include <stdint.h> @@ -10,6 +10,7 @@ #include "main.h" #include "applets.h" +#include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -805,7 +805,7 @@ qcache_stats(qcache_data *data) #endif { struct stat s; - char spath[_Q_PATH_MAX]; + char spath[_Q_PATH_MAX * 2]; snprintf(spath, sizeof(spath), "%s/%s", catpath, de->d_name); if (lstat(spath, &s) != 0) continue; @@ -223,7 +223,12 @@ qgrep_print_before_context(qgrep_buf_t *current, const char num_lines_before, /* Yield the path of one of the installed ebuilds (from VDB). */ static char * -get_next_installed_ebuild(char *ebuild_path, DIR *vdb_dir, struct dirent **cat_dirent_pt, DIR **cat_dir_pt) +get_next_installed_ebuild( + char *ebuild_path, + size_t ebuild_path_len, + DIR *vdb_dir, + struct dirent **cat_dirent_pt, + DIR **cat_dir_pt) { struct dirent *pkg_dirent = NULL; if (*cat_dirent_pt == NULL || *cat_dir_pt == NULL) @@ -233,7 +238,7 @@ get_next_ebuild_from_category: goto get_next_category; if (pkg_dirent->d_name[0] == '.') goto get_next_ebuild_from_category; - snprintf(ebuild_path, _Q_PATH_MAX, "%s/%s/%s.ebuild", + snprintf(ebuild_path, ebuild_path_len, "%s/%s/%s.ebuild", (*cat_dirent_pt)->d_name, pkg_dirent->d_name, pkg_dirent->d_name); return ebuild_path; get_next_category: @@ -260,7 +265,7 @@ int qgrep_main(int argc, char **argv) DIR *vdb_dir = NULL; DIR *cat_dir = NULL; struct dirent *dentry = NULL; - char ebuild[_Q_PATH_MAX]; + char ebuild[_Q_PATH_MAX * 4]; char name[_Q_PATH_MAX * 2]; char *label; int reflags = 0; @@ -420,8 +425,8 @@ int qgrep_main(int argc, char **argv) && snprintf(ebuild, sizeof(ebuild), "eclass/%s", dentry->d_name)) : (do_installed - ? (get_next_installed_ebuild(ebuild, vdb_dir, - &dentry, &cat_dir) != NULL) + ? (get_next_installed_ebuild(ebuild, sizeof(ebuild), + vdb_dir, &dentry, &cat_dir) != NULL) : (fgets(ebuild, sizeof(ebuild), fp) != NULL))) { FILE *newfp; @@ -15,6 +15,7 @@ #include <stdio.h> #include <stdlib.h> #include <ctype.h> +#include <limits.h> #include "atom.h" #include "eat_file.h" @@ -850,13 +850,13 @@ merge_tree_at(int fd_src, const char *src, int fd_dst, const char *dst, int fd_srcf, fd_dstf; unsigned char *hash; const char *tmpname, *dname; - char buf[_Q_PATH_MAX]; + char buf[_Q_PATH_MAX * 2]; /* syntax: obj filename hash mtime */ hash = hash_file_at(subfd_src, name, HASH_MD5); if (!pretend) - fprintf(contents, "obj %s %s %"PRIu64"\n", - cpath, hash, (uint64_t)st.st_mtime); + fprintf(contents, "obj %s %s %zu""\n", + cpath, hash, (size_t)st.st_mtime); free(hash); /* Check CONFIG_PROTECT */ @@ -954,8 +954,8 @@ merge_tree_at(int fd_src, const char *src, int fd_dst, const char *dst, /* syntax: sym src -> dst mtime */ if (!pretend) - fprintf(contents, "sym %s -> %s %"PRIu64"\n", - cpath, sym, (uint64_t)st.st_mtime); + fprintf(contents, "sym %s -> %s %zu\n", + cpath, sym, (size_t)st.st_mtime); qprintf("%s>>>%s %s%s -> %s%s\n", GREEN, NORM, CYAN, cpath, sym, NORM); *objs = add_set(cpath, *objs); @@ -77,7 +77,7 @@ qpkg_clean_dir(char *dirp, set *vdb) set *ll = NULL; struct dirent **fnames; int i, count; - char buf[_Q_PATH_MAX]; + char buf[_Q_PATH_MAX * 2]; struct stat st; uint64_t num_all_bytes = 0; size_t disp_units = 0; @@ -186,7 +186,7 @@ qpkg_clean(char *dirp) num_all_bytes = qpkg_clean_dir(dirp, vdb); for (i = 0; i < count; i++) { - char buf[_Q_PATH_MAX]; + char buf[_Q_PATH_MAX * 2]; snprintf(buf, sizeof(buf), "%s/%s", dirp, dnames[i]->d_name); num_all_bytes += qpkg_clean_dir(buf, vdb); } @@ -11,6 +11,7 @@ #include "applets.h" #include <stdio.h> +#include <unistd.h> #include <string.h> #include <xalloc.h> #include <sys/types.h> @@ -10,8 +10,11 @@ #include "main.h" #include "applets.h" +#include <stdio.h> +#include <unistd.h> #include <string.h> #include <sys/types.h> +#include <sys/stat.h> #include <signal.h> #include <fcntl.h> @@ -11,6 +11,7 @@ #include "applets.h" #include <stdio.h> +#include <unistd.h> #include <string.h> #include <xalloc.h> #include <sys/types.h> |