-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This patch looks good to me. acked. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/I+F4ACgkQrlYvE4MpobOpvwCeOMmZEXYS2+cXHHn62D1K1qRI tMMAoKdzUfw9YJ+iTVQfIvD1F4ZHCsgN =2zuZ -----END PGP SIGNATURE-----
>From 24eb7607ad27a64e4ff67fae1c7da810a17e9069 Mon Sep 17 00:00:00 2001 From: Martin Orr <martin@xxxxxxxxxxxxxx> Date: Sun, 11 Mar 2012 22:59:08 +0000 Subject: [PATCH 29/90] policycoreutils: setfiles: Fix process_glob error handling process_one_realpath returns 1 if it changed the context of the file but process_glob treats all non-zero values as errors. This results in setfiles exiting with non-zero status even though it was successful. Fix process_glob to only treat negative return values of process_one_realpath as errors. cf. http://bugs.debian.org/662990 Signed-off-by: Martin Orr <martin@xxxxxxxxxxxxxx> Signed-off-by: Eric Paris <eparis@xxxxxxxxxx> --- policycoreutils/setfiles/restore.c | 4 +++- policycoreutils/setfiles/setfiles.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/policycoreutils/setfiles/restore.c b/policycoreutils/setfiles/restore.c index e24b100..1b59e2f 100644 --- a/policycoreutils/setfiles/restore.c +++ b/policycoreutils/setfiles/restore.c @@ -446,7 +446,9 @@ int process_glob(char *name, int recurse) { continue; if (len > 0 && strcmp(&globbuf.gl_pathv[i][len], "/..") == 0) continue; - errors |= process_one_realpath(globbuf.gl_pathv[i], recurse); + int rc = process_one_realpath(globbuf.gl_pathv[i], recurse); + if (rc < 0) + errors = rc; } globfree(&globbuf); return errors; diff --git a/policycoreutils/setfiles/setfiles.c b/policycoreutils/setfiles/setfiles.c index 08ec370..f64ee16 100644 --- a/policycoreutils/setfiles/setfiles.c +++ b/policycoreutils/setfiles/setfiles.c @@ -450,13 +450,13 @@ int main(int argc, char **argv) buf[len - 1] = 0; if (!strcmp(buf, "/")) mass_relabel = 1; - errors |= process_glob(buf, recurse); + errors |= process_glob(buf, recurse) < 0; } if (strcmp(input_filename, "-") != 0) fclose(f); } else { for (i = optind; i < argc; i++) { - errors |= process_glob(argv[i], recurse); + errors |= process_glob(argv[i], recurse) < 0; } } -- 1.7.10.2