1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-15 05:57:49 +03:00

messaging3: Remove use of full_path_tos()

This is not performance critical, and this removes source3 specific
code

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2014-06-02 22:29:44 +02:00 committed by Jeremy Allison
parent 516e2f5e68
commit 748ffccd5a

View File

@ -57,9 +57,8 @@ static int messaging_dgm_context_destructor(struct messaging_dgm_context *c);
static int messaging_dgm_lockfile_create(const char *cache_dir, pid_t pid,
int *plockfile_fd, uint64_t unique)
{
char buf[PATH_MAX];
char *dir, *to_free;
ssize_t dirlen;
fstring buf;
char *dir;
char *lockfile_name;
int lockfile_fd;
struct flock lck = {};
@ -67,9 +66,8 @@ static int messaging_dgm_lockfile_create(const char *cache_dir, pid_t pid,
ssize_t written;
bool ok;
dirlen = full_path_tos(cache_dir, "lck", buf, sizeof(buf),
&dir, &to_free);
if (dirlen == -1) {
dir = talloc_asprintf(talloc_tos(), "%s/lck", cache_dir);
if (dir == NULL) {
return ENOMEM;
}
@ -78,13 +76,13 @@ static int messaging_dgm_lockfile_create(const char *cache_dir, pid_t pid,
ret = errno;
DEBUG(1, ("%s: Could not create lock directory: %s\n",
__func__, strerror(ret)));
TALLOC_FREE(to_free);
TALLOC_FREE(dir);
return ret;
}
lockfile_name = talloc_asprintf(talloc_tos(), "%s/%u", dir,
(unsigned)pid);
TALLOC_FREE(to_free);
TALLOC_FREE(dir);
if (lockfile_name == NULL) {
DEBUG(1, ("%s: talloc_asprintf failed\n", __func__));
return ENOMEM;