Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144805258
D23280.1776542496.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D23280.1776542496.diff
View Options
Index: contrib/mtree/spec.c
===================================================================
--- contrib/mtree/spec.c
+++ contrib/mtree/spec.c
@@ -100,7 +100,7 @@
static void replacenode(NODE *, NODE *);
static void set(char *, NODE *);
static void unset(char *, NODE *);
-static void addchild(NODE *, NODE *);
+static void addchild(NODE *, NODE **);
static int nodecmp(const NODE *, const NODE *);
static int appendfield(FILE *, int, const char *, ...) __printflike(3, 4);
@@ -235,7 +235,7 @@
* full path entry; add or replace
*/
centry->parent = pathparent;
- addchild(pathparent, centry);
+ addchild(pathparent, ¢ry);
last = centry;
} else if (strcmp(centry->name, ".") == 0) {
/*
@@ -248,7 +248,7 @@
* add or replace
*/
centry->parent = last;
- addchild(last, centry);
+ addchild(last, ¢ry);
last = centry;
} else {
/*
@@ -257,7 +257,7 @@
* add or replace
*/
centry->parent = last->parent;
- addchild(last->parent, centry);
+ addchild(last->parent, ¢ry);
last = centry;
}
}
@@ -717,8 +717,9 @@
* pathparent->child. Keep the list sorted if Sflag is set.
*/
static void
-addchild(NODE *pathparent, NODE *centry)
+addchild(NODE *pathparent, NODE **pcentry)
{
+ NODE *centry = *pcentry;
NODE *samename; /* node with the same name as centry */
NODE *replacepos; /* if non-NULL, centry should replace this node */
NODE *insertpos; /* if non-NULL, centry should be inserted
@@ -778,6 +779,8 @@
* free the information in the centry node.
*/
replacenode(samename, centry);
+ *pcentry = samename;
+ centry = *pcentry;
if (samename == replacepos) {
/* The just-replaced node was in the correct position */
return;
@@ -800,7 +803,6 @@
* the just-replaced node from the list, and allow it to
* be insterted in the correct position later.
*/
- centry = samename;
if (centry->prev)
centry->prev->next = centry->next;
else {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 18, 8:01 PM (4 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28379015
Default Alt Text
D23280.1776542496.diff (1 KB)
Attached To
Mode
D23280: Fix nmtree crashing with duplicate items
Attached
Detach File
Event Timeline
Log In to Comment