public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-projects commit in portage-utils/libq: profile.c scandirat.c vdb.c xmkdir.c
@ 2014-02-16 21:14 Mike Frysinger (vapier)
  0 siblings, 0 replies; only message in thread
From: Mike Frysinger (vapier) @ 2014-02-16 21:14 UTC (permalink / raw
  To: gentoo-commits

vapier      14/02/16 21:14:24

  Modified:             profile.c scandirat.c vdb.c xmkdir.c
  Log:
  start using O_PATH

Revision  Changes    Path
1.5                  portage-utils/libq/profile.c

file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/profile.c?rev=1.5&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/profile.c?rev=1.5&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/profile.c?r1=1.4&r2=1.5

Index: profile.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/libq/profile.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- profile.c	19 Dec 2011 20:27:36 -0000	1.4
+++ profile.c	16 Feb 2014 21:14:24 -0000	1.5
@@ -10,7 +10,7 @@
 	char *buf;
 
 	/* Pop open this profile dir */
-	subdir_fd = openat(dir_fd, dir, O_RDONLY|O_CLOEXEC);
+	subdir_fd = openat(dir_fd, dir, O_RDONLY|O_CLOEXEC|O_PATH);
 	if (subdir_fd < 0)
 		return data;
 



1.8                  portage-utils/libq/scandirat.c

file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/scandirat.c?rev=1.8&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/scandirat.c?rev=1.8&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/scandirat.c?r1=1.7&r2=1.8

Index: scandirat.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/libq/scandirat.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- scandirat.c	17 Nov 2013 10:26:53 -0000	1.7
+++ scandirat.c	16 Feb 2014 21:14:24 -0000	1.8
@@ -1,7 +1,7 @@
 /*
  * Copyright 2005-2011 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/scandirat.c,v 1.7 2013/11/17 10:26:53 grobian Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/scandirat.c,v 1.8 2014/02/16 21:14:24 vapier Exp $
  *
  * Copyright 2005-2010 Ned Ludd        - <solar@gentoo.org>
  * Copyright 2005-2011 Mike Frysinger  - <vapier@gentoo.org>
@@ -29,6 +29,7 @@
 	DIR *dirp;
 	struct dirent *de, **ret;
 
+	/* Cannot use O_PATH as we want to use fdopendir() */
 	fd = openat(dir_fd, dir, O_RDONLY|O_CLOEXEC);
 	if (fd == -1)
 		return -1;



1.6                  portage-utils/libq/vdb.c

file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/vdb.c?rev=1.6&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/vdb.c?rev=1.6&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/vdb.c?r1=1.5&r2=1.6

Index: vdb.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/libq/vdb.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- vdb.c	28 Oct 2012 06:27:59 -0000	1.5
+++ vdb.c	16 Feb 2014 21:14:24 -0000	1.6
@@ -1,7 +1,7 @@
 /*
  * Copyright 2005-2011 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/vdb.c,v 1.5 2012/10/28 06:27:59 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/vdb.c,v 1.6 2014/02/16 21:14:24 vapier Exp $
  *
  * Copyright 2005-2010 Ned Ludd        - <solar@gentoo.org>
  * Copyright 2005-2011 Mike Frysinger  - <vapier@gentoo.org>
@@ -24,7 +24,7 @@
 
 	if (!sroot)
 		sroot = portroot;
-	ctx->portroot_fd = open(sroot, O_RDONLY|O_CLOEXEC);
+	ctx->portroot_fd = open(sroot, O_RDONLY|O_CLOEXEC|O_PATH);
 	if (ctx->portroot_fd == -1) {
 		warnp("could not open root: %s", sroot);
 		goto f_error;
@@ -36,6 +36,7 @@
 	svdb++;
 	if (*svdb == '\0')
 		svdb = ".";
+	/* Cannot use O_PATH as we want to use fdopendir() */
 	ctx->vdb_fd = openat(ctx->portroot_fd, svdb, O_RDONLY|O_CLOEXEC);
 	if (ctx->vdb_fd == -1) {
 		warnp("could not open vdb: %s (in root %s)", svdb, sroot);
@@ -114,6 +115,7 @@
 	int fd;
 	DIR *dir;
 
+	/* Cannot use O_PATH as we want to use fdopendir() */
 	fd = openat(ctx->vdb_fd, name, O_RDONLY|O_CLOEXEC);
 	if (fd == -1)
 		return NULL;
@@ -194,9 +196,10 @@
 	q_vdb_pkg_ctx *pkg_ctx;
 	int fd;
 
-	fd = openat(cat_ctx->fd, name, O_RDONLY|O_CLOEXEC);
+//	fd = openat(cat_ctx->fd, name, O_RDONLY|O_CLOEXEC|O_PATH);
 	if (fd == -1)
 		return NULL;
+	fd = -1;
 
 	pkg_ctx = xmalloc(sizeof(*pkg_ctx));
 	pkg_ctx->name = name;
@@ -251,7 +254,8 @@
 
 _q_static void q_vdb_close_pkg(q_vdb_pkg_ctx *pkg_ctx)
 {
-	close(pkg_ctx->fd);
+	if (pkg_ctx->fd != -1)
+		close(pkg_ctx->fd);
 	free(pkg_ctx);
 }
 



1.6                  portage-utils/libq/xmkdir.c

file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/xmkdir.c?rev=1.6&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/xmkdir.c?rev=1.6&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/xmkdir.c?r1=1.5&r2=1.6

Index: xmkdir.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/libq/xmkdir.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- xmkdir.c	30 Apr 2013 01:56:37 -0000	1.5
+++ xmkdir.c	16 Feb 2014 21:14:24 -0000	1.6
@@ -43,6 +43,7 @@
 	DIR *dir;
 	struct dirent *de;
 
+	/* Cannot use O_PATH as we want to use fdopendir() */
 	subdfd = openat(dfd, path, O_RDONLY|O_CLOEXEC|O_NOFOLLOW);
 	if (subdfd < 0)
 		return -1;





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-02-16 21:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-16 21:14 [gentoo-commits] gentoo-projects commit in portage-utils/libq: profile.c scandirat.c vdb.c xmkdir.c Mike Frysinger (vapier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox