Hardik Goyal | b09d6b0 | 2019-08-13 16:15:50 -0700 | [diff] [blame^] | 1 | // Copyright 2019 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "debugd/src/helper_utils.h" |
| 6 | |
| 7 | #include <inttypes.h> |
| 8 | #include <vector> |
| 9 | |
| 10 | #include <base/strings/stringprintf.h> |
| 11 | |
| 12 | namespace debugd { |
| 13 | |
| 14 | bool GetHelperPath(const std::string& relative_path, std::string* full_path) { |
| 15 | const char* helpers_dir = "/usr/libexec/debugd/helpers"; |
| 16 | std::string path = |
| 17 | base::StringPrintf("%s/%s", helpers_dir, relative_path.c_str()); |
| 18 | |
| 19 | if (path.length() > PATH_MAX) |
| 20 | return false; |
| 21 | |
| 22 | *full_path = path; |
| 23 | return true; |
| 24 | } |
| 25 | |
| 26 | } // namespace debugd |