messaging3: Remove use of full_path_tos()
authorVolker Lendecke <vl@samba.org>
Mon, 2 Jun 2014 20:29:44 +0000 (22:29 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 18 Jun 2014 16:51:13 +0000 (18:51 +0200)
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>
source3/lib/messages_dgm.c

index edef8892d3590cd36c03ed01c044b656a49bbcfe..8836bf8c818c3700da65fdeed393cf3694287697 100644 (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;