From c67cff0372d987d13105b81a7625ff42a3ceac43 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 5 Jul 2010 19:43:25 +0200 Subject: s3-winbind: Create all logfiles in the same directory. If log file is set in the config file, we should create the log files of the winbind child processes in the same directory. --- source3/winbindd/winbindd_dual.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index e506d2a53a..277b174306 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -405,10 +405,31 @@ void setup_child(struct winbindd_domain *domain, struct winbindd_child *child, const char *logname) { if (logprefix && logname) { + char *logbase = NULL; + + if (lp_logfile()) { + char *end = NULL; + + if (asprintf(&logbase, "%s", lp_logfile()) < 0) { + smb_panic("Internal error: asprintf failed"); + } + + if ((end = strrchr_m(logbase, '/'))) { + *end = '\0'; + } + } else { + if (asprintf(&logbase, "%s", get_dyn_LOGFILEBASE()) < 0) { + smb_panic("Internal error: asprintf failed"); + } + } + if (asprintf(&child->logfilename, "%s/%s-%s", - get_dyn_LOGFILEBASE(), logprefix, logname) < 0) { + logbase, logprefix, logname) < 0) { + SAFE_FREE(logbase); smb_panic("Internal error: asprintf failed"); } + + SAFE_FREE(logbase); } else { smb_panic("Internal error: logprefix == NULL && " "logname == NULL"); -- cgit