svn commit: samba r25141 - in branches: SAMBA_3_2/source/smbd SAMBA_3_2_0/source/smbd

jra at samba.org jra at samba.org
Fri Sep 14 01:08:01 GMT 2007


Author: jra
Date: 2007-09-14 01:07:57 +0000 (Fri, 14 Sep 2007)
New Revision: 25141

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25141

Log:
More pstring removal.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/smbd/oplock_irix.c
   branches/SAMBA_3_2_0/source/smbd/oplock_irix.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/oplock_irix.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/oplock_irix.c	2007-09-13 22:41:04 UTC (rev 25140)
+++ branches/SAMBA_3_2/source/smbd/oplock_irix.c	2007-09-14 01:07:57 UTC (rev 25141)
@@ -33,17 +33,25 @@
 {
 	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 @@
 		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 "

Modified: branches/SAMBA_3_2_0/source/smbd/oplock_irix.c
===================================================================
--- branches/SAMBA_3_2_0/source/smbd/oplock_irix.c	2007-09-13 22:41:04 UTC (rev 25140)
+++ branches/SAMBA_3_2_0/source/smbd/oplock_irix.c	2007-09-14 01:07:57 UTC (rev 25141)
@@ -33,17 +33,25 @@
 {
 	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 @@
 		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 "



More information about the samba-cvs mailing list