public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/, /
Date: Wed, 27 Mar 2019 20:18:45 +0000 (UTC)	[thread overview]
Message-ID: <1553717900.3cf77d19bd7f3abd323e4f148f73575cee8ac85b.grobian@gentoo> (raw)

commit:     3cf77d19bd7f3abd323e4f148f73575cee8ac85b
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 27 20:18:20 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Mar 27 20:18:20 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=3cf77d19

q: fix various issues on Linux systems

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 libq/contents.c |  1 +
 libq/xpak.c     |  2 +-
 libq/xsystem.c  |  7 +++++--
 main.c          |  4 ++--
 main.h          |  1 +
 q.c             |  1 +
 qcache.c        |  2 +-
 qgrep.c         | 15 ++++++++++-----
 qlop.c          |  1 +
 qmerge.c        | 10 +++++-----
 qpkg.c          |  4 ++--
 qsearch.c       |  1 +
 qtegrity.c      |  3 +++
 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)
 {

diff --git a/main.c b/main.c
index 1da04fe..7e56101 100644
--- a/main.c
+++ b/main.c
@@ -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);

diff --git a/main.h b/main.h
index 958efa6..32c995f 100644
--- a/main.h
+++ b/main.h
@@ -15,6 +15,7 @@
 #endif
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 #include <stdint.h>

diff --git a/q.c b/q.c
index a4a943e..1e180de 100644
--- a/q.c
+++ b/q.c
@@ -10,6 +10,7 @@
 #include "main.h"
 #include "applets.h"
 
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>

diff --git a/qcache.c b/qcache.c
index 29b10af..f3252d7 100644
--- a/qcache.c
+++ b/qcache.c
@@ -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;

diff --git a/qgrep.c b/qgrep.c
index da38f40..fdabf9c 100644
--- a/qgrep.c
+++ b/qgrep.c
@@ -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;

diff --git a/qlop.c b/qlop.c
index b8038b4..b6970d0 100644
--- a/qlop.c
+++ b/qlop.c
@@ -15,6 +15,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
+#include <limits.h>
 
 #include "atom.h"
 #include "eat_file.h"

diff --git a/qmerge.c b/qmerge.c
index 81da0b1..97726db 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -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);

diff --git a/qpkg.c b/qpkg.c
index 3ff4507..37f1cb7 100644
--- a/qpkg.c
+++ b/qpkg.c
@@ -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);
 	}

diff --git a/qsearch.c b/qsearch.c
index 5ae68bc..f543b8a 100644
--- a/qsearch.c
+++ b/qsearch.c
@@ -11,6 +11,7 @@
 #include "applets.h"
 
 #include <stdio.h>
+#include <unistd.h>
 #include <string.h>
 #include <xalloc.h>
 #include <sys/types.h>

diff --git a/qtegrity.c b/qtegrity.c
index 2e3b859..70a99d5 100644
--- a/qtegrity.c
+++ b/qtegrity.c
@@ -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>
 

diff --git a/quse.c b/quse.c
index 62ae166..c93be87 100644
--- a/quse.c
+++ b/quse.c
@@ -11,6 +11,7 @@
 #include "applets.h"
 
 #include <stdio.h>
+#include <unistd.h>
 #include <string.h>
 #include <xalloc.h>
 #include <sys/types.h>


             reply	other threads:[~2019-03-27 20:18 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27 20:18 Fabian Groffen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-06-27 19:19 [gentoo-commits] proj/portage-utils:master commit in: libq/, / Fabian Groffen
2024-03-29 10:57 Fabian Groffen
2024-01-02  7:57 Fabian Groffen
2023-02-07  8:25 Fabian Groffen
2023-02-07  8:10 Fabian Groffen
2021-08-16 13:23 Fabian Groffen
2020-02-21  8:18 Fabian Groffen
2020-01-05 13:28 Fabian Groffen
2020-01-02 11:19 Fabian Groffen
2020-01-01 19:52 Fabian Groffen
2019-12-31  9:05 Fabian Groffen
2019-12-30 17:24 Fabian Groffen
2019-12-29 13:26 Fabian Groffen
2019-12-27 16:57 Fabian Groffen
2019-07-13 10:04 Fabian Groffen
2019-06-19 10:44 Fabian Groffen
2019-06-05  9:15 Fabian Groffen
2019-05-09 20:19 Fabian Groffen
2019-05-05 18:13 Fabian Groffen
2019-04-28 15:20 Fabian Groffen
2019-03-27 10:55 Fabian Groffen
2019-03-22  9:57 Fabian Groffen
2019-03-19 20:32 Fabian Groffen
2019-03-19 20:32 Fabian Groffen
2019-03-09 18:58 Fabian Groffen
2018-03-23 11:56 Fabian Groffen
2016-12-29  2:25 Mike Frysinger
2016-11-26 23:17 Mike Frysinger
2015-11-28  2:44 Mike Frysinger
2015-02-24  1:26 Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1553717900.3cf77d19bd7f3abd323e4f148f73575cee8ac85b.grobian@gentoo \
    --to=grobian@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox