Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147753421
D44531.1784276247.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D44531.1784276247.diff
View Options
diff --git a/contrib/mtree/spec.c b/contrib/mtree/spec.c
--- a/contrib/mtree/spec.c
+++ b/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 NODE * addchild(NODE *, NODE *);
static int nodecmp(const NODE *, const NODE *);
static int appendfield(FILE *, int, const char *, ...) __printflike(3, 4);
@@ -235,8 +235,7 @@
* full path entry; add or replace
*/
centry->parent = pathparent;
- addchild(pathparent, centry);
- last = centry;
+ last = addchild(pathparent, centry);
} else if (strcmp(centry->name, ".") == 0) {
/*
* duplicate "." entry; always replace
@@ -248,8 +247,7 @@
* add or replace
*/
centry->parent = last;
- addchild(last, centry);
- last = centry;
+ last = addchild(last, centry);
} else {
/*
* new relative child in parent dir
@@ -257,8 +255,7 @@
* add or replace
*/
centry->parent = last->parent;
- addchild(last->parent, centry);
- last = centry;
+ last = addchild(last->parent, centry);
}
}
return (root);
@@ -716,7 +713,7 @@
* a duplicate, insert it into the linked list referenced by
* pathparent->child. Keep the list sorted if Sflag is set.
*/
-static void
+static NODE *
addchild(NODE *pathparent, NODE *centry)
{
NODE *samename; /* node with the same name as centry */
@@ -735,7 +732,7 @@
if (cur == NULL) {
/* centry is pathparent's first and only child node so far */
pathparent->child = centry;
- return;
+ return (centry);
}
/*
@@ -778,9 +775,10 @@
* free the information in the centry node.
*/
replacenode(samename, centry);
+ centry = samename;
if (samename == replacepos) {
/* The just-replaced node was in the correct position */
- return;
+ return (centry);
}
if (samename == insertpos || samename->prev == insertpos) {
/*
@@ -788,7 +786,7 @@
* or just after the replaced node, but that would
* be equivalent to just retaining the replaced node.
*/
- return;
+ return (centry);
}
/*
@@ -828,7 +826,7 @@
if (centry->next)
centry->next->prev = centry;
}
- return;
+ return (centry);
}
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jul 17, 8:17 AM (7 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29166340
Default Alt Text
D44531.1784276247.diff (2 KB)
Attached To
Mode
D44531: mtree: Fix duplicated entries handling in spec()
Attached
Detach File
Event Timeline
Log In to Comment