> find /path/to/dir -type d -print0 | xargs -0 chmod a+rx
> find /path/to/dir -type f -print0 | xargs -0 chmod a+r
>
> That way, xargs bunches up the arguments into as many arguments as chmod
> can handle, and calls it fewer times.
>
> The -print0 and -0 are GNU extensions to handle spaces in names.
That's even worse than original. You've got a very wide race here -
think what happens if luser does
cd /path/to/dir/something/writable/to/luser
mkdir bar
mkdir baz
for i in `seq 1 500`; do
mkdir bar/$i
touch bar/$i/shadow
ln -sf /etc baz/$i
done
before you start, then waits for first chmod a+r and does
mv bar quux; mv baz bar
leaving you with very interesting results. It's much wider window than
in the original.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/