diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-23 20:42:32 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-23 20:56:54 +0100 |
commit | 5d180d1f996ead27f9c5cb3db7f91e293de34d9d (patch) | |
tree | e881854dac5d749518562970d6194a0ef65736ec /Userland/Libraries/LibCore/Account.cpp | |
parent | b33a6a443e700cd80325d312f21c985b0687bb97 (diff) | |
download | serenity-5d180d1f996ead27f9c5cb3db7f91e293de34d9d.zip |
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)
Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.
We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
Diffstat (limited to 'Userland/Libraries/LibCore/Account.cpp')
-rw-r--r-- | Userland/Libraries/LibCore/Account.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Libraries/LibCore/Account.cpp b/Userland/Libraries/LibCore/Account.cpp index 5a71b1e053..2b2e5d28c0 100644 --- a/Userland/Libraries/LibCore/Account.cpp +++ b/Userland/Libraries/LibCore/Account.cpp @@ -200,9 +200,9 @@ String Account::generate_passwd_file() const void Account::load_shadow_file() { auto file_or_error = Core::File::open("/etc/shadow", Core::File::ReadOnly); - ASSERT(!file_or_error.is_error()); + VERIFY(!file_or_error.is_error()); auto shadow_file = file_or_error.release_value(); - ASSERT(shadow_file->is_open()); + VERIFY(shadow_file->is_open()); Vector<ShadowEntry> entries; @@ -250,7 +250,7 @@ bool Account::sync() auto new_shadow_file_content = generate_shadow_file(); if (new_passwd_file_content.is_null() || new_shadow_file_content.is_null()) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } char new_passwd_name[] = "/etc/passwd.XXXXXX"; @@ -260,34 +260,34 @@ bool Account::sync() auto new_passwd_fd = mkstemp(new_passwd_name); if (new_passwd_fd < 0) { perror("mkstemp"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ScopeGuard new_passwd_fd_guard = [new_passwd_fd] { close(new_passwd_fd); }; auto new_shadow_fd = mkstemp(new_shadow_name); if (new_shadow_fd < 0) { perror("mkstemp"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } ScopeGuard new_shadow_fd_guard = [new_shadow_fd] { close(new_shadow_fd); }; if (fchmod(new_passwd_fd, 0644) < 0) { perror("fchmod"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto nwritten = write(new_passwd_fd, new_passwd_file_content.characters(), new_passwd_file_content.length()); if (nwritten < 0) { perror("write"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(static_cast<size_t>(nwritten) == new_passwd_file_content.length()); + VERIFY(static_cast<size_t>(nwritten) == new_passwd_file_content.length()); nwritten = write(new_shadow_fd, new_shadow_file_content.characters(), new_shadow_file_content.length()); if (nwritten < 0) { perror("write"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } - ASSERT(static_cast<size_t>(nwritten) == new_shadow_file_content.length()); + VERIFY(static_cast<size_t>(nwritten) == new_shadow_file_content.length()); } if (rename(new_passwd_name, "/etc/passwd") < 0) { |