From c0277892d079dc2d8fcd5bbb5061369ddd8d9c74 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 16 Dec 2005 11:54:05 +0000 Subject: r12285: move the smbd.tmp into piddir, --with-fhs piddir is different from lockdir and they are typically set to piddir=/var/run/samba and lockdir=/var/lib/samba, and we should keep the temporary stuff under /var/run/samba metze (This used to be commit 571a870618cf595930da3057b147058489c8a37b) --- source4/lib/util.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/source4/lib/util.c b/source4/lib/util.c index 0733103e93..1b51fe5e05 100644 --- a/source4/lib/util.c +++ b/source4/lib/util.c @@ -625,6 +625,29 @@ char *lock_path(TALLOC_CTX* mem_ctx, const char *name) return fname; } + +/***************************************************************** + A useful function for returning a path in the Samba piddir directory. +*****************************************************************/ +char *pid_path(TALLOC_CTX* mem_ctx, const char *name) +{ + char *fname, *dname; + + dname = talloc_strdup(mem_ctx, lp_piddir()); + trim_string(dname,"","/"); + + if (!directory_exist(dname)) { + mkdir(dname,0755); + } + + fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name); + + talloc_free(dname); + + return fname; +} + + /** * @brief Returns an absolute path to a file in the Samba lib directory. * @@ -670,7 +693,7 @@ char *smbd_tmp_path(TALLOC_CTX *mem_ctx, const char *name) { char *fname, *dname; - dname = lock_path(mem_ctx, "smbd.tmp"); + dname = pid_path(mem_ctx, "smbd.tmp"); if (!directory_exist(dname)) { mkdir(dname,0755); } -- cgit