From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id DA220138334 for ; Thu, 30 May 2019 12:52:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 17593E096E; Thu, 30 May 2019 12:50:54 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B7B8BE096B for ; Thu, 30 May 2019 12:50:53 +0000 (UTC) Received: from localhost.localdomain (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 2088A345356; Thu, 30 May 2019 12:50:51 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 5/9] user.eclass: Die if no free UID/GID is found Date: Thu, 30 May 2019 14:50:35 +0200 Message-Id: <20190530125039.15591-6-mgorny@gentoo.org> X-Mailer: git-send-email 2.22.0.rc1 In-Reply-To: <20190530125039.15591-1-mgorny@gentoo.org> References: <20190530125039.15591-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 68a45721-e40a-4ba3-9f2e-5badb9d76c26 X-Archives-Hash: d1a93f5267017707d882578a756a36df Signed-off-by: Michał Górny --- eclass/user.eclass | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eclass/user.eclass b/eclass/user.eclass index 1ffeaae29569..b16c4c6d69b7 100644 --- a/eclass/user.eclass +++ b/eclass/user.eclass @@ -160,6 +160,7 @@ enewuser() { for ((euid = 101; euid <= 999; euid++)); do [[ -z $(egetent passwd ${euid}) ]] && break done + [[ ${euid} -le 999 ]] || die "${FUNCNAME}: no free UID found" fi opts+=( -u ${euid} ) einfo " - Userid: ${euid}" @@ -344,6 +345,7 @@ enewgroup() { for ((egid = 101; egid <= 999; egid++)) ; do [[ -z $(egetent group ${egid}) ]] && break done + [[ ${egid} -le 999 ]] || die "${FUNCNAME}: no free GID found" fi } -- 2.22.0.rc1