diff --exclude-from=exclude -N -u -r nsapolicycoreutils/restorecon/restorecon.c policycoreutils-1.19.2/restorecon/restorecon.c --- nsapolicycoreutils/restorecon/restorecon.c 2005-01-05 15:12:59.569516712 -0500 +++ policycoreutils-1.19.2/restorecon/restorecon.c 2005-01-05 15:11:14.994550830 -0500 @@ -43,6 +43,20 @@ static int errors=0; static int recurse; +/* Compare two contexts to see if their differences are "significant", + * or whether the only difference is in the user. */ +static int only_changed_user(const char *a, const char *b) +{ + char *rest_a, *rest_b; /* Rest of the context after the user */ + rest_a = strchr(a, ':'); + rest_b = strchr(b, ':'); + if (!rest_a || !rest_b) + return 0; + if (strcmp(rest_a, rest_b) == 0) + return 1; + return 0; +} + void usage(const char * const name) { fprintf(stderr, @@ -129,9 +143,10 @@ freecon(scontext); return 1; } else - if (verbose) - fprintf(stderr,"%s reset context %s:%s->%s\n", - progname, filename, prev_context, scontext); + if (verbose > 1 || + !only_changed_user(scontext, prev_context)) + fprintf(stderr,"%s reset context %s:%s->%s\n", + progname, filename, prev_context, scontext); } if (retcontext >= 0) freecon(prev_context);