Avoid odd behavior when clearing nonexistent SID
It's expected that clearSecureUserId is sometimes called with a userId
that doesn't currently have a Gatekeeper enrollment. For example, this
happens whenever a user with no LSKF is removed. gatekeeperd currently
has two odd behaviors when it's asked to do this. First, it logs the
following message at ERROR level, which is not appropriate:
E gatekeeperd: clear_sid: could not remove file [No such file or directory], attempting 0 write
Second, it writes 0 to the file /data/misc/gatekeeper/$userId. This
makes this file exist even after the user has been removed, which
doesn't cause a real problem but is unexpected.
Fix both of these issues by making clear_sid() check for ENOENT.
Bug: 188702845
Bug: 268526331
Change-Id: Ib1b110f2502267004f5c945c28c98ae926b2a794
1 file changed