r25141: More pstring removal.
authorJeremy Allison <jra@samba.org>
Fri, 14 Sep 2007 01:07:57 +0000 (01:07 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:30:45 +0000 (12:30 -0500)
Jeremy.
(This used to be commit cfcf7cf03e1be34e6839c1a659c4e8c1b5358c37)

source3/smbd/oplock_irix.c

index dde32fa288476f187e6d8e988fd4eb00df6f8df1..9f81a960f53a456b23b5736f92ee0e5a93d09241 100644 (file)
@@ -33,17 +33,25 @@ static BOOL irix_oplocks_available(void)
 {
        int fd;
        int pfd[2];
-       pstring tmpname;
+       TALLOC_CTX *ctx = talloc_stackframe();
+       char *tmpname = NULL;
 
        set_effective_capability(KERNEL_OPLOCK_CAPABILITY);
 
-       slprintf(tmpname,sizeof(tmpname)-1, "%s/koplock.%d", lp_lockdir(),
-                (int)sys_getpid());
+       tmpname = talloc_asprintf(ctx,
+                               "%s/koplock.%d",
+                               lp_lockdir(),
+                               (int)sys_getpid());
+       if (!tmpname) {
+               TALLOC_FREE(ctx);
+               return False;
+       }
 
        if(pipe(pfd) != 0) {
                DEBUG(0,("check_kernel_oplocks: Unable to create pipe. Error "
                         "was %s\n",
                         strerror(errno) ));
+               TALLOC_FREE(ctx);
                return False;
        }
 
@@ -54,11 +62,14 @@ static BOOL irix_oplocks_available(void)
                unlink( tmpname );
                close(pfd[0]);
                close(pfd[1]);
+               TALLOC_FREE(ctx);
                return False;
        }
 
        unlink(tmpname);
 
+       TALLOC_FREE(ctx);
+
        if(sys_fcntl_long(fd, F_OPLKREG, pfd[1]) == -1) {
                DEBUG(0,("check_kernel_oplocks: Kernel oplocks are not "
                         "available on this machine. Disabling kernel oplock "