diff options
author | Armelle Laine <armellel@google.com> | 2022-10-22 05:07:40 +0000 |
---|---|---|
committer | Armelle Laine <armellel@google.com> | 2022-12-03 06:22:10 +0000 |
commit | 8b2dfec0f8f866a02749388abc5e447dbb0f2563 (patch) | |
tree | 02c9c3713f95e84d7df1ea4d95cfe4fb90a1b7e8 | |
parent | d3586e84c998fba6577f203c62b5405e1ea8d96a (diff) | |
download | gatekeeper-8b2dfec0f8f866a02749388abc5e447dbb0f2563.tar.gz |
properly use return value of storage_delete_file
Bug: 244777939
Change-Id: I3ce7de7a2faa82ee73c4850807c96a4b813d1dfb
-rw-r--r-- | trusty_gatekeeper.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/trusty_gatekeeper.cpp b/trusty_gatekeeper.cpp index db5ed84..e20258d 100644 --- a/trusty_gatekeeper.cpp +++ b/trusty_gatekeeper.cpp @@ -434,13 +434,17 @@ gatekeeper_error_t TrustyGateKeeper::RemoveAllUsers() { storage_open_dir_state *state; rc = storage_open_dir(session, "", &state); - + if (rc < 0) { + TLOGE("Error:[%d] opening storage dir.\n", rc); + storage_close_session(session); + return ERROR_UNKNOWN; + } while (true) { uint8_t dir_flags = 0; char name[STORAGE_ID_LENGTH_MAX]; rc = storage_read_dir(session, state, &dir_flags, name, STORAGE_ID_LENGTH_MAX); if (rc < 0) { - TLOGE("Error:[%d] opening storage dir.\n", rc); + TLOGE("Error:[%d] reading storage dir.\n", rc); storage_close_session(session); return ERROR_UNKNOWN; } @@ -448,7 +452,7 @@ gatekeeper_error_t TrustyGateKeeper::RemoveAllUsers() { break; } if (!strncmp(name, GATEKEEPER_PREFIX, strlen(GATEKEEPER_PREFIX))) { - storage_delete_file(session, name, 0); + rc = storage_delete_file(session, name, 0); if (rc < 0) { TLOGE("Error:[%d] deleting storage object.\n", rc); storage_close_session(session); |