summaryrefslogtreecommitdiffstats
path: root/fastboot/util_linux.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-08-31 15:07:18 -0700
committerElliott Hughes <enh@google.com>2016-09-01 09:24:24 -0700
commit82ff315bb0fecb9127970e01b399be53c92ca14f (patch)
tree194dfb8de311f236afdeebce4a5933e4a99cef6b /fastboot/util_linux.cpp
parent6a5ed849e832aac7da24fca5b7cf01d7c052f56e (diff)
downloadsystem_core-82ff315bb0fecb9127970e01b399be53c92ca14f.tar.gz
system_core-82ff315bb0fecb9127970e01b399be53c92ca14f.tar.bz2
system_core-82ff315bb0fecb9127970e01b399be53c92ca14f.zip
Add android::base::GetExecutablePath, switch adb and fastboot over.
We'd long had two copies of this stuff, so rather than rewrite both Linux versions to use android::base::Readlink, let's kill the duplication too... Bug: http://b/30988271 Change-Id: I4de58a94a22a4b1faf969a6fc70ca1560a4d5121
Diffstat (limited to 'fastboot/util_linux.cpp')
-rw-r--r--fastboot/util_linux.cpp43
1 files changed, 0 insertions, 43 deletions
diff --git a/fastboot/util_linux.cpp b/fastboot/util_linux.cpp
deleted file mode 100644
index 2c6aedb3e..000000000
--- a/fastboot/util_linux.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "fastboot.h"
-
-#include <unistd.h>
-#include <limits.h>
-
-#include <android-base/stringprintf.h>
-
-std::string get_my_path() {
- std::string proc = android::base::StringPrintf("/proc/%d/exe", getpid());
- char path[PATH_MAX + 1];
- int rc = readlink(proc.c_str(), path, sizeof(path) - 1);
- if (rc == -1) return "";
- path[rc] = '\0';
- return path;
-}