From 7b3a3f004f96ed3cb9cc377f7e64bfc88195dfc2 Mon Dec 13 16:41:34 2021
From: From: Florian Festi <ffesti@redhat.com>
Date: Mon, 13 Dec 2021 16:41:34 +0800
Subject: [PATCH] Use root as default UID_0_USER and UID_0_GROUP

If /etc/passwd or /etc/group was not available during building rpm itself
these ended up empty. This affects builds done later on using rpmbuild.

Resolves: #1838
---
 configure.ac | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure.ac b/configure.ac
index cdaf2b6..8656043 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1050,6 +1050,8 @@ fi
 
 user_with_uid0=$(awk -F: '$3==0 {print $1;exit}' /etc/passwd)
 group_with_gid0=$(awk -F: '$3==0 {print $1;exit}' /etc/group)
+if test -z "$user_with_uid0" ; then user_with_uid0=root ; fi
+if test -z "$group_with_gid0" ; then group_with_gid0=root ; fi
 AC_DEFINE_UNQUOTED([UID_0_USER],["$user_with_uid0"],[Get the user name having userid 0])
 AC_DEFINE_UNQUOTED([GID_0_GROUP],["$group_with_gid0"],[Get the group name having groupid 0])
 
-- 
1.8.3.1

