From e4e2be0d8b5778ecc5c521b9e0e0b4c05ac87394 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 28 Jul 2006 22:56:41 +0000 Subject: r17294: Make the code a little cleaner. Instead of using the two calls make it : become_root_uid_only() operation unbecome_root_uid_only() saving errno across the second call. Most of our internal change calls can be replaced with these simple calls. Jeremy (This used to be commit 4143aa83c029848d8ec741d9218b3fa6e3fd28dd) --- source3/lib/messages.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'source3/lib/messages.c') diff --git a/source3/lib/messages.c b/source3/lib/messages.c index bae4052964..410e4af659 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -167,7 +167,6 @@ static TDB_DATA message_key_pid(struct process_id pid) static BOOL message_notify(struct process_id procid) { pid_t pid = procid.pid; - int saved_errno; int ret; uid_t euid = geteuid(); @@ -179,23 +178,21 @@ static BOOL message_notify(struct process_id procid) SMB_ASSERT(pid > 0); if (euid != 0) { - save_re_uid(); - set_effective_uid(0); + become_root_uid_only(); } ret = kill(pid, SIGUSR1); - saved_errno = errno; if (euid != 0) { - restore_re_uid(); + unbecome_root_uid_only(); } if (ret == -1) { - if (saved_errno == ESRCH) { + if (errno == ESRCH) { DEBUG(2,("pid %d doesn't exist - deleting messages record\n", (int)pid)); tdb_delete(tdb, message_key_pid(procid)); } else { - DEBUG(2,("message to process %d failed - %s\n", (int)pid, strerror(saved_errno))); + DEBUG(2,("message to process %d failed - %s\n", (int)pid, strerror(errno))); } return False; } -- cgit