summaryrefslogtreecommitdiffstats
path: root/base/chromeos/chromeos_version.cc
blob: 4a70cd5312aad80213e9eb3cdd7c9e6ec420411b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/chromeos/chromeos_version.h"

#include <stdlib.h>
#include <string.h>

#include "base/logging.h"

namespace base {
namespace chromeos {

bool IsRunningOnChromeOS() {
  // Check if the user name is chronos. Note that we don't go with
  // getuid() + getpwuid_r() as it may end up reading /etc/passwd, which
  // can be expensive.
  const char* user = getenv("USER");
  return user && strcmp(user, "chronos") == 0;
}

}  // namespace chromeos
}  // namespace base