From 87597357116dffd4e1136c16aab431844877a247 Mon Sep 17 00:00:00 2001
From: Roy Marples <roy@marples.name>
Date: Tue, 8 Apr 2008 22:57:42 +0000
Subject: Give an error when running zap as a generic user.

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

(limited to 'src/librc')

diff --git a/src/librc/librc.c b/src/librc/librc.c
index afd20d5f..c94c7a4b 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -501,7 +501,7 @@ bool rc_service_mark(const char *service, const RC_SERVICE state)
 	base = basename_c(service);
 
 	if (state != RC_SERVICE_STOPPED) {
-		if (! exists(init)) {
+		if (!exists(init)) {
 			free(init);
 			return false;
 		}
@@ -547,7 +547,10 @@ bool rc_service_mark(const char *service, const RC_SERVICE state)
 					symlink(init, was);
 					skip_wasinactive = true;
 				}
-				unlink(file);
+				if (unlink(file) == -1) {
+					free(init);
+					return false;
+				}
 			}
 		}
 	}
-- 
cgit v1.2.3