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> |
Simon Glass | b51cc13 | 2020-06-10 12:30:53 -0600 | [diff] [blame] | 8 | #include <limits.h> |
Hardik Goyal | b09d6b0 | 2019-08-13 16:15:50 -0700 | [diff] [blame] | 9 | #include <vector> |
| 10 | |
| 11 | #include <base/strings/stringprintf.h> |
| 12 | |
| 13 | namespace debugd { |
| 14 | |
| 15 | bool GetHelperPath(const std::string& relative_path, std::string* full_path) { |
| 16 | const char* helpers_dir = "/usr/libexec/debugd/helpers"; |
| 17 | std::string path = |
| 18 | base::StringPrintf("%s/%s", helpers_dir, relative_path.c_str()); |
| 19 | |
Simon Glass | b51cc13 | 2020-06-10 12:30:53 -0600 | [diff] [blame] | 20 | if (path.length() >= PATH_MAX) |
Hardik Goyal | b09d6b0 | 2019-08-13 16:15:50 -0700 | [diff] [blame] | 21 | return false; |
| 22 | |
| 23 | *full_path = path; |
| 24 | return true; |
| 25 | } |
| 26 | |
| 27 | } // namespace debugd |