openbsd-ports/devel/adb/patches/patch-adb_get_my_path_generic_c
2022-03-11 18:49:30 +00:00

40 lines
1.0 KiB
Plaintext

--- adb/get_my_path_generic.c.orig Tue May 5 07:56:50 2015
+++ adb/get_my_path_generic.c Tue May 5 07:56:50 2015
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include <unistd.h>
+
+static char const* exe_buf;
+
+void init_my_path(const char* exe)
+{
+ exe_buf = exe;
+}
+
+void get_my_path(char *exe, size_t maxLen)
+{
+ if(exe_buf == NULL) {
+ exe[0] = '\0';
+ return;
+ }
+
+ strlcpy(exe, exe_buf, maxLen);
+}
+