From 9f1a774c671a03c1849c9bf1b7c31f9fe7995f73 Mon Sep 17 00:00:00 2001 From: Arkaitz Ruiz Alvarez Date: Thu, 26 May 2011 12:22:22 -0700 Subject: [PATCH] Determine guest mode status for metrics collection Modification to the function IsGuestMode. It returns true only if the guestfs partition is mounted and the file /var/run/state/logged-in exits. Previously it did not check for this file existence. BUG=chromium-os:15763 TEST=Log in in to guest mode right after installing recovery image and check the absence of /home/chronos/prev_stats. Log out and log in as a user and confirm the existence of this directory. Change-Id: I7b0e7e8844332cca3fa67611b90fada3c5ba0eeb Reviewed-on: http://gerrit.chromium.org/gerrit/1647 Tested-by: Arkaitz Ruiz Alvarez Reviewed-by: Darin Petkov --- metrics/metrics_library.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metrics/metrics_library.cc b/metrics/metrics_library.cc index 0f2a7d900..d2c1b0fd1 100644 --- a/metrics/metrics_library.cc +++ b/metrics/metrics_library.cc @@ -126,7 +126,7 @@ bool MetricsLibrary::IsGuestMode() { &result)) { return false; } - return result && access("/var/run/state/logged-in", F_OK) == 0; + return result && (access("/var/run/state/logged-in", F_OK) == 0); } bool MetricsLibrary::AreMetricsEnabled() {