Deleted Added
sdiff udiff text old ( 133264 ) new ( 144295 )
full compact
1/*-
2 * Copyright (c) 2003 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/usr.sbin/mtree/specspec.c 144295 2005-03-29 11:44:17Z tobez $");
29
30#include <err.h>
31#include <grp.h>
32#include <pwd.h>
33#include <stdio.h>
34#include <stdint.h>
35#include <unistd.h>
36#include "mtree.h"

--- 40 unchanged lines hidden (view full) ---

77 printf(" uname=%s", pw->pw_name);
78 }
79 if (f & F_MD5)
80 printf(" md5digest=%s", n->md5digest);
81 if (f & F_SHA1)
82 printf(" sha1digest=%s", n->sha1digest);
83 if (f & F_RMD160)
84 printf(" rmd160digest=%s", n->rmd160digest);
85 if (f & F_SHA256)
86 printf(" sha256digest=%s", n->sha256digest);
87 if (f & F_FLAGS)
88 printf(" flags=%s", flags_to_string(n->st_flags));
89 printf("\n");
90}
91
92static int
93mismatch(NODE *n1, NODE *n2, int differ, char const *path)
94{

--- 62 unchanged lines hidden (view full) ---

157 if (FF(n1, n2, F_UNAME, st_uid))
158 differs |= F_UNAME;
159 if (FS(n1, n2, F_MD5, md5digest))
160 differs |= F_MD5;
161 if (FS(n1, n2, F_SHA1, sha1digest))
162 differs |= F_SHA1;
163 if (FS(n1, n2, F_RMD160, rmd160digest))
164 differs |= F_RMD160;
165 if (FS(n1, n2, F_SHA256, sha256digest))
166 differs |= F_SHA256;
167 if (FF(n1, n2, F_FLAGS, st_flags))
168 differs |= F_FLAGS;
169 if (differs) {
170 mismatch(n1, n2, differs, path);
171 return (1);
172 }
173 return (0);
174}

--- 37 unchanged lines hidden (view full) ---

212 c2 = NULL;
213 }
214 }
215 }
216 if (c1 == NULL && c2->type == F_DIR) {
217 asprintf(&np, "%s%s/", path, c2->name);
218 i = walk_in_the_forest(c1, c2, np);
219 free(np);
220 i += compare_nodes(c1, c2, path);
221 } else if (c2 == NULL && c1->type == F_DIR) {
222 asprintf(&np, "%s%s/", path, c1->name);
223 i = walk_in_the_forest(c1, c2, np);
224 free(np);
225 i += compare_nodes(c1, c2, path);
226 } else if (c1 == NULL || c2 == NULL) {
227 i = compare_nodes(c1, c2, path);
228 } else if (c1->type == F_DIR && c2->type == F_DIR) {
229 asprintf(&np, "%s%s/", path, c1->name);
230 i = walk_in_the_forest(c1, c2, np);
231 free(np);
232 i += compare_nodes(c1, c2, path);
233 } else {
234 i = compare_nodes(c1, c2, path);
235 }
236 r += i;
237 c1 = n1;
238 c2 = n2;
239 }
240 return (r);

--- 16 unchanged lines hidden ---