[PATCH] daemon: print "access denied" if a service does not work
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
Note that if a service fails, then "access denied" is printed too.
Not sure if it's a good thing, the service in question may have
responded to user already. On the other hand, this catches faults
from start_command() in run_service_command().
daemon.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/daemon.c b/daemon.c
index 4c8346d..6552ca7 100644
--- a/daemon.c
+++ b/daemon.c
@@ -562,7 +562,10 @@ static int execute(void)
* Note: The directory here is probably context sensitive,
* and might depend on the actual service being performed.
*/
- return run_service(line + namelen + 5, s);
+ if (!run_service(line + namelen + 5, s))
+ return 0;
+ packet_write(1, "ERR %s: access denied", line + namelen + 5);
+ return -1;
}
}
--
1.7.3.1.256.g2539c.dirty