[sheepdog] [PATCH 2/6] sheep: use _exit(2) instead of exit(3) in lock_and_daemon() for gcc's destructors

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Fri Jan 9 08:37:15 CET 2015


Because exit(3) calls registered destructors of gcc, it calling it in
lock_and_daemon() conflicts with LTTng. This patch let the function
use _exit(2) for avoiding this problem.

Cc: Gu Ping <guping610 at qq.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 sheep/sheep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sheep/sheep.c b/sheep/sheep.c
index 9fc7610..9471a3b 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -571,7 +571,7 @@ static int lock_and_daemon(bool daemonize, const char *base_dir)
 			if (ret != sizeof(status))
 				panic("read exit status failed: %m");
 
-			exit(status);
+			_exit(status);
 			break;
 		}
 
@@ -589,7 +589,7 @@ static int lock_and_daemon(bool daemonize, const char *base_dir)
 			status = 1;
 			goto end;
 		default:
-			exit(0);
+			_exit(0);
 			break;
 		}
 
-- 
1.9.1




More information about the sheepdog mailing list