svn commit: samba r22755 - in branches: SAMBA_3_0/source/smbd SAMBA_3_0_25/source/smbd SAMBA_3_0_26/source/smbd

vlendec at samba.org vlendec at samba.org
Mon May 7 20:53:11 GMT 2007


Author: vlendec
Date: 2007-05-07 20:53:10 +0000 (Mon, 07 May 2007)
New Revision: 22755

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

Log:
Second half of r22754. As it stands now, string_replace expects a
pstring. Give it one, although I hate putting it in :-)

Thanks to Tom Bork! :-)

Modified:
   branches/SAMBA_3_0/source/smbd/notify.c
   branches/SAMBA_3_0_25/source/smbd/notify.c
   branches/SAMBA_3_0_26/source/smbd/notify.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/notify.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/notify.c	2007-05-07 19:27:46 UTC (rev 22754)
+++ branches/SAMBA_3_0/source/smbd/notify.c	2007-05-07 20:53:10 UTC (rev 22755)
@@ -337,7 +337,7 @@
 static void notify_fsp(files_struct *fsp, uint32 action, const char *name)
 {
 	struct notify_change *change, *changes;
-	char *name2;
+	pstring name2;
 
 	if (fsp->notify == NULL) {
 		/*
@@ -346,11 +346,7 @@
 		return;
 	}
 
-	if (!(name2 = talloc_strdup(fsp->notify, name))) {
-		DEBUG(0, ("talloc_strdup failed\n"));
-			return;
-	}
-
+	pstrcpy(name2, name);
 	string_replace(name2, '/', '\\');
 
 	/*
@@ -364,7 +360,6 @@
 		 * guard against a DoS here.
 		 */
 		TALLOC_FREE(fsp->notify->changes);
-		TALLOC_FREE(name2);
 		fsp->notify->num_changes = -1;
 		return;
 	}
@@ -377,7 +372,6 @@
 		      fsp->notify, fsp->notify->changes,
 		      struct notify_change, fsp->notify->num_changes+1))) {
 		DEBUG(0, ("talloc_realloc failed\n"));
-		TALLOC_FREE(name2);
 		return;
 	}
 
@@ -385,7 +379,11 @@
 
 	change = &(fsp->notify->changes[fsp->notify->num_changes]);
 
-	change->name = talloc_move(changes, &name2);
+	if (!(change->name = talloc_strdup(changes, name2))) {
+		DEBUG(0, ("talloc_strdup failed\n"));
+		return;
+	}
+
 	change->action = action;
 	fsp->notify->num_changes += 1;
 
@@ -401,7 +399,7 @@
 		 * We have to send the two rename events in one reply. So hold
 		 * the first part back.
 		 */
-	return;
+		return;
 	}
 
 	/*

Modified: branches/SAMBA_3_0_25/source/smbd/notify.c
===================================================================
--- branches/SAMBA_3_0_25/source/smbd/notify.c	2007-05-07 19:27:46 UTC (rev 22754)
+++ branches/SAMBA_3_0_25/source/smbd/notify.c	2007-05-07 20:53:10 UTC (rev 22755)
@@ -336,7 +336,7 @@
 static void notify_fsp(files_struct *fsp, uint32 action, const char *name)
 {
 	struct notify_change *change, *changes;
-	char *name2;
+	pstring name2;
 
 	if (fsp->notify == NULL) {
 		/*
@@ -345,11 +345,7 @@
 		return;
 	}
 
-	if (!(name2 = talloc_strdup(fsp->notify, name))) {
-		DEBUG(0, ("talloc_strdup failed\n"));
-			return;
-	}
-
+	pstrcpy(name2, name);
 	string_replace(name2, '/', '\\');
 
 	/*
@@ -363,7 +359,6 @@
 		 * guard against a DoS here.
 		 */
 		TALLOC_FREE(fsp->notify->changes);
-		TALLOC_FREE(name2);
 		fsp->notify->num_changes = -1;
 		return;
 	}
@@ -376,7 +371,6 @@
 		      fsp->notify, fsp->notify->changes,
 		      struct notify_change, fsp->notify->num_changes+1))) {
 		DEBUG(0, ("talloc_realloc failed\n"));
-		TALLOC_FREE(name2);
 		return;
 	}
 
@@ -384,7 +378,11 @@
 
 	change = &(fsp->notify->changes[fsp->notify->num_changes]);
 
-	change->name = talloc_move(changes, &name2);
+	if (!(change->name = talloc_strdup(changes, name2))) {
+		DEBUG(0, ("talloc_strdup failed\n"));
+		return;
+	}
+
 	change->action = action;
 	fsp->notify->num_changes += 1;
 
@@ -400,7 +398,7 @@
 		 * We have to send the two rename events in one reply. So hold
 		 * the first part back.
 		 */
-	return;
+		return;
 	}
 
 	/*

Modified: branches/SAMBA_3_0_26/source/smbd/notify.c
===================================================================
--- branches/SAMBA_3_0_26/source/smbd/notify.c	2007-05-07 19:27:46 UTC (rev 22754)
+++ branches/SAMBA_3_0_26/source/smbd/notify.c	2007-05-07 20:53:10 UTC (rev 22755)
@@ -336,7 +336,7 @@
 static void notify_fsp(files_struct *fsp, uint32 action, const char *name)
 {
 	struct notify_change *change, *changes;
-	char *name2;
+	pstring name2;
 
 	if (fsp->notify == NULL) {
 		/*
@@ -345,11 +345,7 @@
 		return;
 	}
 
-	if (!(name2 = talloc_strdup(fsp->notify, name))) {
-		DEBUG(0, ("talloc_strdup failed\n"));
-			return;
-	}
-
+	pstrcpy(name2, name);
 	string_replace(name2, '/', '\\');
 
 	/*
@@ -363,7 +359,6 @@
 		 * guard against a DoS here.
 		 */
 		TALLOC_FREE(fsp->notify->changes);
-		TALLOC_FREE(name2);
 		fsp->notify->num_changes = -1;
 		return;
 	}
@@ -376,7 +371,6 @@
 		      fsp->notify, fsp->notify->changes,
 		      struct notify_change, fsp->notify->num_changes+1))) {
 		DEBUG(0, ("talloc_realloc failed\n"));
-		TALLOC_FREE(name2);
 		return;
 	}
 
@@ -384,7 +378,11 @@
 
 	change = &(fsp->notify->changes[fsp->notify->num_changes]);
 
-	change->name = talloc_move(changes, &name2);
+	if (!(change->name = talloc_strdup(changes, name2))) {
+		DEBUG(0, ("talloc_strdup failed\n"));
+		return;
+	}
+
 	change->action = action;
 	fsp->notify->num_changes += 1;
 
@@ -400,7 +398,7 @@
 		 * We have to send the two rename events in one reply. So hold
 		 * the first part back.
 		 */
-	return;
+		return;
 	}
 
 	/*



More information about the samba-cvs mailing list