diff --git a/lib/subordinateio.c b/lib/subordinateio.c index bf02328e7..2fdbdea3b 100644 --- a/lib/subordinateio.c +++ b/lib/subordinateio.c @@ -807,7 +807,6 @@ static bool get_owner_id(const char *owner, enum subid_type id_type, char *id) { struct passwd *pw; struct group *gr; - int ret = 0; switch (id_type) { case ID_TYPE_UID: @@ -815,20 +814,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;