public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/openrc:openrc-0.13.x commit in: src/librc/
@ 2014-10-24 16:02 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2014-10-24 16:02 UTC (permalink / raw
  To: gentoo-commits

commit:     8a68dc899e93ff925fac8417148cebbdaa975849
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Oct 24 15:44:14 2014 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Oct 24 15:59:16 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=8a68dc89

Fix compile errors created by bundling queue.h

---
 src/librc/rc.h.in | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in
index 62119e9..58d8eb5 100644
--- a/src/librc/rc.h.in
+++ b/src/librc/rc.h.in
@@ -77,6 +77,51 @@ extern "C" {
 #  define RC_LOCAL_CONFDIR      RC_LOCAL_PREFIX "/etc/conf.d"
 #endif
 
+#ifndef _SYS_QUEUE_H_
+
+/*
+ * The following are copied directly from our imported queue.h.
+ */
+
+/*
+ * List definitions.
+ */
+#define	LIST_HEAD(name, type)						\
+struct name {								\
+	struct type *lh_first;	/* first element */			\
+}
+
+#define	LIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	LIST_ENTRY(type)						\
+struct {								\
+	struct type *le_next;	/* next element */			\
+	struct type **le_prev;	/* address of previous next element */	\
+}
+
+/*
+ * Tail queue definitions.
+ */
+#define	_TAILQ_HEAD(name, type, qual)					\
+struct name {								\
+	qual type *tqh_first;		/* first element */		\
+	qual type *qual *tqh_last;	/* addr of last next element */	\
+}
+#define TAILQ_HEAD(name, type)	_TAILQ_HEAD(name, struct type,)
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ TAILQ_END(head), &(head).tqh_first }
+
+#define	_TAILQ_ENTRY(type, qual)					\
+struct {								\
+	qual type *tqe_next;		/* next element */		\
+	qual type *qual *tqe_prev;	/* address of previous next element */\
+}
+#define TAILQ_ENTRY(type)	_TAILQ_ENTRY(struct type,)
+
+#endif /* _SYS_QUEUE_H_ */
+
 /* A doubly linked list using queue(3) for ease of use */
 typedef struct rc_string {
 	char *value;


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/openrc:openrc-0.13.x commit in: src/librc/
@ 2015-01-15 16:01 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2015-01-15 16:01 UTC (permalink / raw
  To: gentoo-commits

commit:     fb81028121471c32bbcc88a61956baa7264ff090
Author:     Doug Freed <dwfreed <AT> mtu <DOT> edu>
AuthorDate: Mon Jan 12 15:10:29 2015 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Jan 13 07:07:02 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=fb810281

fix double free of pidfile

This fixes a double free of the pidfile variable. For discussion of this
issue, see the bug.

X-Gentoo-Bug: 531600
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=531600

---
 src/librc/librc-daemon.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index 02aff5a..76fdd7b 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -560,22 +560,20 @@ rc_service_daemons_crashed(const char *service)
 			spidfile = xmalloc(strlen(ch_root) + strlen(pidfile) + 1);
 			strcpy(spidfile, ch_root);
 			strcat(spidfile, pidfile);
+			free(pidfile);
+			pidfile = spidfile;
 		}
 
 		pid = 0;
-		if (spidfile) {
+		if (pidfile) {
 			retval = true;
-			if ((fp = fopen(spidfile, "r"))) {
+			if ((fp = fopen(pidfile, "r"))) {
 				if (fscanf(fp, "%d", &pid) == 1)
 					retval = false;
 				fclose(fp);
 			}
-			free(spidfile);
-			spidfile = NULL;
-			if (ch_root) {
-				free(pidfile);
-				pidfile = NULL;
-			}
+			free(pidfile);
+			pidfile = NULL;
 
 			/* We have the pid, so no need to match
 			   on exec or name */


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/openrc:openrc-0.13.x commit in: src/librc/
@ 2014-11-01 23:33 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2014-11-01 23:33 UTC (permalink / raw
  To: gentoo-commits

commit:     cb2c45a3c092de617fa037089599e624a758aea9
Author:     Alexander Vershilov <alexander.vershilov <AT> gmail <DOT> com>
AuthorDate: Wed Oct 29 20:16:35 2014 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Nov  1 23:32:26 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=cb2c45a3

Fix incorrect handling of chroot option.
Fixes #28.

X-Gentoo-Bug: #527370
X-Gentoo-Bug-Url: https://bugs.gentoo.org/show_bug.cgi?id=527370

---
 src/librc/librc-daemon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index 190a014..02aff5a 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -556,8 +556,8 @@ rc_service_daemons_crashed(const char *service)
 
 		char *ch_root = rc_service_value_get(basename_c(service), "chroot");
 		char *spidfile = pidfile;
-		if (ch_root) {
-			spidfile = malloc(strlen(ch_root) + strlen(pidfile));
+		if (ch_root && pidfile) {
+			spidfile = xmalloc(strlen(ch_root) + strlen(pidfile) + 1);
 			strcpy(spidfile, ch_root);
 			strcat(spidfile, pidfile);
 		}


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/openrc:openrc-0.13.x commit in: src/librc/
@ 2014-10-24 16:02 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2014-10-24 16:02 UTC (permalink / raw
  To: gentoo-commits

commit:     4777035d53cc56444865cbeb287e2b5e73d7e901
Author:     Gabriele Giacone <1o5g4r8o <AT> gmail <DOT> com>
AuthorDate: Wed Oct 22 20:02:51 2014 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Oct 24 15:59:16 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=4777035d

Fix rc_svcdir for GNU/Hurd

---
 src/librc/rc.h.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in
index 8f0e889..34f09f2 100644
--- a/src/librc/rc.h.in
+++ b/src/librc/rc.h.in
@@ -42,7 +42,7 @@ extern "C" {
 #define RC_LIBEXECDIR           "@LIBEXECDIR@"
 #if defined(PREFIX)
 #define RC_SVCDIR               RC_LIBEXECDIR "/init.d"
-#elif defined(__linux__) || defined(__FreeBSD_kernel__)
+#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
 #define RC_SVCDIR               "/run/openrc"
 #else
 #define RC_SVCDIR               RC_LIBEXECDIR "/init.d"


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/openrc:openrc-0.13.x commit in: src/librc/
@ 2014-10-24 16:02 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2014-10-24 16:02 UTC (permalink / raw
  To: gentoo-commits

commit:     91734d20be62dfbf7f637df576b70c9f04bae73d
Author:     Gabriele Giacone <1o5g4r8o <AT> gmail <DOT> com>
AuthorDate: Wed Oct 22 02:17:52 2014 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Oct 24 15:59:15 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=91734d20

Fix rc_svcdir for GNU/kFreeBSD

---
 src/librc/rc.h.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in
index 5ef8d7f..8f0e889 100644
--- a/src/librc/rc.h.in
+++ b/src/librc/rc.h.in
@@ -42,7 +42,7 @@ extern "C" {
 #define RC_LIBEXECDIR           "@LIBEXECDIR@"
 #if defined(PREFIX)
 #define RC_SVCDIR               RC_LIBEXECDIR "/init.d"
-#elif defined(__linux__)
+#elif defined(__linux__) || defined(__FreeBSD_kernel__)
 #define RC_SVCDIR               "/run/openrc"
 #else
 #define RC_SVCDIR               RC_LIBEXECDIR "/init.d"


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/openrc:openrc-0.13.x commit in: src/librc/
@ 2014-10-20 21:05 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2014-10-20 21:05 UTC (permalink / raw
  To: gentoo-commits

commit:     735dc45c392821fbb278ed9cbdefbf8b07b2c750
Author:     Alexander Vershilov <alexander.vershilov <AT> gmail <DOT> com>
AuthorDate: Mon Oct 20 00:41:36 2014 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Oct 20 21:03:27 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=735dc45c

librc:look for the pid file in a chroot if defined

X-Gentoo-Bug: 524388
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=524388

---
 src/librc/librc-daemon.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index 8793075..04f25b1 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -553,16 +553,28 @@ rc_service_daemons_crashed(const char *service)
 		}
 		fclose(fp);
 
+		char *ch_root = rc_service_value_get(basename_c(service), "chroot");
+		char *spidfile = pidfile;
+		if (ch_root) {
+			spidfile = malloc(strlen(ch_root) + strlen(pidfile));
+			strcpy(spidfile, ch_root);
+			strcat(spidfile, pidfile);
+		}
+
 		pid = 0;
-		if (pidfile) {
+		if (spidfile) {
 			retval = true;
-			if ((fp = fopen(pidfile, "r"))) {
+			if ((fp = fopen(spidfile, "r"))) {
 				if (fscanf(fp, "%d", &pid) == 1)
 					retval = false;
 				fclose(fp);
 			}
-			free(pidfile);
-			pidfile = NULL;
+			free(spidfile);
+			spidfile = NULL;
+			if (ch_root) {
+				free(pidfile);
+				pidfile = NULL;
+			}
 
 			/* We have the pid, so no need to match
 			   on exec or name */


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-15 16:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-24 16:02 [gentoo-commits] proj/openrc:openrc-0.13.x commit in: src/librc/ William Hubbs
  -- strict thread matches above, loose matches on Subject: below --
2015-01-15 16:01 William Hubbs
2014-11-01 23:33 William Hubbs
2014-10-24 16:02 William Hubbs
2014-10-24 16:02 William Hubbs
2014-10-20 21:05 William Hubbs

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