From 361f5ce2b82765aa38a16abaeb92c475220336d3 Mon Sep 17 00:00:00 2001
From: William Hubbs <w.d.hubbs@gmail.com>
Date: Thu, 4 Oct 2012 22:01:33 -0500
Subject: set the RC_UNAME environment variable when updating dependencies

This is needed because the network script uses this variable in the
depend() function but it wasn't exported when this was run.

Reported-by: <aaly90@gmail.com>
---
 src/librc/librc-depend.c | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'src')

diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c
index 5e99c1b0..ac93716b 100644
--- a/src/librc/librc-depend.c
+++ b/src/librc/librc-depend.c
@@ -28,6 +28,8 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/utsname.h>
+
 #include "librc.h"
 
 #define GENDEP          RC_LIBEXECDIR "/sh/gendepends.sh"
@@ -747,12 +749,15 @@ rc_deptree_update(void)
 	size_t i, k, l;
 	bool retval = true;
 	const char *sys = rc_sys();
+	struct utsname uts;
 
 	/* Some init scripts need RC_LIBEXECDIR to source stuff
 	   Ideally we should be setting our full env instead */
 	if (!getenv("RC_LIBEXECDIR"))
 		setenv("RC_LIBEXECDIR", RC_LIBEXECDIR, 0);
 
+	if (uname(&uts) == 0)
+		setenv("RC_UNAME", uts.sysname, 1);
 	/* Phase 1 - source all init scripts and print dependencies */
 	if (!(fp = popen(GENDEP, "r")))
 		return false;
-- 
cgit v1.2.3