diff --git a/lib/salt.c b/lib/salt.c index 529d59cace..2e23c16e57 100644 --- a/lib/salt.c +++ b/lib/salt.c @@ -175,7 +175,7 @@ static /*@observer@*/void SHA_salt_rounds_to_buf (char *buf, unsigned long round */ assert (GENSALT_SETTING_SIZE > buf_begin + 17); - (void) snprintf (buf + buf_begin, 18, "rounds=%lu$", rounds); + snprintf(buf + buf_begin, 18, "rounds=%lu$", rounds); } #endif /* USE_SHA_CRYPT */ @@ -254,7 +254,7 @@ static /*@observer@*/void BCRYPT_salt_rounds_to_buf (char *buf, unsigned long ro */ assert (GENSALT_SETTING_SIZE > buf_begin + 3); - (void) snprintf (buf + buf_begin, 4, "%2.2lu$", rounds); + snprintf(buf + buf_begin, 4, "%2.2lu$", rounds); } #endif /* USE_BCRYPT */ diff --git a/lib/subordinateio.c b/lib/subordinateio.c index 245d56ca49..9cdef8e252 100644 --- a/lib/subordinateio.c +++ b/lib/subordinateio.c @@ -777,9 +777,8 @@ gid_t sub_gid_find_free_range(gid_t min, gid_t max, unsigned long count) static bool get_owner_id(const char *owner, enum subid_type id_type, char *id) { - struct passwd *pw; - struct group *gr; - int ret = 0; + struct group *gr; + struct passwd *pw; switch (id_type) { case ID_TYPE_UID: @@ -787,20 +786,16 @@ static bool get_owner_id(const char *owner, enum subid_type id_type, char *id) if (pw == NULL) { return false; } - ret = snprintf(id, ID_SIZE, "%u", pw->pw_uid); - if (ret < 0 || ret >= ID_SIZE) { + if (snprintf_(id, ID_SIZE, "%u", pw->pw_uid) == -1) return false; - } break; case ID_TYPE_GID: gr = getgrnam(owner); if (gr == NULL) { return false; } - ret = snprintf(id, ID_SIZE, "%u", gr->gr_gid); - if (ret < 0 || ret >= ID_SIZE) { + if (snprintf_(id, ID_SIZE, "%u", gr->gr_gid) == -1) return false; - } break; default: return false;