]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/nfsdcld/nfsdcld.c
nfsdcld: Before clearing the capability bounding set, check if we have the cap
[nfs-utils.git] / utils / nfsdcld / nfsdcld.c
index e7af4e330c85bcd5e5f2166b3805c67479f1705f..473d069da062666086074130aaa546a624b6ea0d 100644 (file)
@@ -102,8 +102,8 @@ cld_set_caps(void)
        }
 
        /* prune the bounding set to nothing */
-       for (i = 0; i <= CAP_LAST_CAP; ++i) {
-               ret = prctl(PR_CAPBSET_DROP, i);
+       for (i = 0; prctl(PR_CAPBSET_READ, i, 0, 0, 0) >= 0 ; ++i) {
+               ret = prctl(PR_CAPBSET_DROP, i, 0, 0, 0);
                if (ret) {
                        xlog(L_ERROR, "Unable to prune capability %lu from "
                                      "bounding set: %m", i);