From dd16ae2506abe46093118e2a33d9d0cae6455d07 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 14 Sep 2007 01:07:57 +0000 Subject: r25141: More pstring removal. Jeremy. (This used to be commit cfcf7cf03e1be34e6839c1a659c4e8c1b5358c37) --- source3/smbd/oplock_irix.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index dde32fa288..9f81a960f5 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -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 " -- cgit