Whamcloud - gitweb
AOSP: android/perms.c: clean up error handling
authorNick Kralevich <nnk@google.com>
Thu, 11 Oct 2018 03:35:17 +0000 (20:35 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 13 Oct 2018 02:58:08 +0000 (22:58 -0400)
commitb7343ebb6369fff623c72b0c41270fb0bb7749ec
treebf32abbc5dcea3201980e650f9bff2af489fb7a4
parentc4ef5b4f6ba589e612a64259a3c49404dd4b0ace
AOSP: android/perms.c: clean up error handling

There are a number of error conditions which, due to the way
ext2fs_dir_iterate2 operates, would not be propagated to the upper
layers of the call stack. As a result, certain error conditions,
such as not having enough room to allocate blocks for SELinux
labels, would fail silently, instead of causing a compile
failure.

As suggested in
https://android-review.googlesource.com/c/platform/external/e2fsprogs/+/324363
, add a error field to the caller's private data structure, and use the
bit in the field to indicate an error condition. Now, certain errors
which were silently ignored will cause a compile failure when compiling
Android.

Test: Artifically modify selabel_lookup() to return a failure, and
      verify Android doesn't compile.
Test: Verify Android compiles under normal circumstances.
Test: Artifically modify ino_add_xattr() to return a failure, and
      verify Android doesn't compile.
Bug: 117502873
Bug: 117567573
Bug: 117473440

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Change-Id: Icdb0105a77e98c3428f20d3c59bf824dcad5db8d
From AOSP commit: 7ca13b8b2953f93536ea09eb2ff19bd7cc85b3c1
contrib/android/perms.c