egetent should consult the correct root

egetent takes an optional parameter for the root under which
to look for /etc/{passwd,group}. I was incorrectly ignoring
this argument when figuring out the path of the db file to
look at, which meant that I always consulted the target root,
even when the caller wanted to check the chroot.

CQ-DEPEND=CL:185724
BUG=chromium:250164
TEST=run build_image many times in a row. Instead of a new entry getting added every time, there should be only one.

TEST=leon-paladin: http://chromegw/p/tryserver.chromiumos/builders/leon-paladin/builds/16
TEST=stumpy-release: http://chromegw/p/tryserver.chromiumos/builders/stumpy-release/builds/365
TEST=chromium-sdk: http://chromegw/p/tryserver.chromiumos/builders/chromiumos-sdk/builds/1076

Change-Id: I5f874c72109b05fcde4fb8550e306ad761292b55
Reviewed-on: https://chromium-review.googlesource.com/185725
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
diff --git a/eclass/user.eclass b/eclass/user.eclass
index 5e24704..bba3626 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -158,8 +158,8 @@
 	*) die "sorry, database '${db}' not yet supported; file a bug" ;;
 	esac
 
-	local dbfile=$(readlink -e "${ROOT}/etc/${db}")
-	[[ ! -e "${dbfile}" ]] && die "${db} under ${ROOT} does not exist."
+	local dbfile=$(readlink -e "${root}/etc/${db}")
+	[[ ! -e "${dbfile}" ]] && die "${db} under ${root} does not exist."
 	[[ ! -w "${dbfile}" ]] && use_lock=false  # File can't change anyway!
 
 	local lockfile="${dbfile}.lock"