160 lines
4.8 KiB
Diff
160 lines
4.8 KiB
Diff
diff --git core/include/ziparchive/zip_archive.h core/include/ziparchive/zip_archive.h
|
|
index 7dc60ae..8886a35 100644
|
|
--- core/include/ziparchive/zip_archive.h
|
|
+++ core/include/ziparchive/zip_archive.h
|
|
@@ -22,11 +22,12 @@
|
|
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
-#include <sys/cdefs.h>
|
|
#include <sys/types.h>
|
|
#include <utils/Compat.h>
|
|
|
|
-__BEGIN_DECLS
|
|
+#ifdef __cplusplus
|
|
+extern "C" {
|
|
+#endif
|
|
|
|
/* Zip compression methods we support */
|
|
enum {
|
|
@@ -215,6 +216,8 @@ int GetFileDescriptor(const ZipArchiveHandle handle);
|
|
|
|
const char* ErrorCodeString(int32_t error_code);
|
|
|
|
-__END_DECLS
|
|
+#ifdef __cplusplus
|
|
+}
|
|
+#endif
|
|
|
|
#endif // LIBZIPARCHIVE_ZIPARCHIVE_H_
|
|
diff --git core/liblog/log_portability.h core/liblog/log_portability.h
|
|
index 3ad2060..2b859c4 100644
|
|
--- core/liblog/log_portability.h
|
|
+++ core/liblog/log_portability.h
|
|
@@ -17,7 +17,6 @@
|
|
#ifndef _LIBLOG_PORTABILITY_H__
|
|
#define _LIBLOG_PORTABILITY_H__
|
|
|
|
-#include <sys/cdefs.h>
|
|
#include <unistd.h>
|
|
|
|
/* Helpful private sys/cdefs.h like definitions */
|
|
|
|
diff --git core/include/private/android_filesystem_config.h core/include/private/android_filesystem_config.h
|
|
index c220a0c..d38f971 100644
|
|
--- core/include/private/android_filesystem_config.h
|
|
+++ core/include/private/android_filesystem_config.h
|
|
@@ -22,7 +22,6 @@
|
|
#ifndef _ANDROID_FILESYSTEM_CONFIG_H_
|
|
#define _ANDROID_FILESYSTEM_CONFIG_H_
|
|
|
|
-#include <sys/cdefs.h>
|
|
#include <sys/types.h>
|
|
#include <stdint.h>
|
|
|
|
@@ -230,7 +229,10 @@ struct fs_path_config {
|
|
|
|
/* Rules for directories and files has moved to system/code/libcutils/fs_config.c */
|
|
|
|
-__BEGIN_DECLS
|
|
+#ifdef __cplusplus
|
|
+extern "C" {
|
|
+#endif
|
|
+
|
|
|
|
/*
|
|
* Used in:
|
|
@@ -247,7 +249,9 @@ void fs_config(const char *path, int dir, const char *target_out_path,
|
|
|
|
ssize_t fs_config_generate(char *buffer, size_t length, const struct fs_path_config *pc);
|
|
|
|
-__END_DECLS
|
|
+#ifdef __cplusplus
|
|
+}
|
|
+#endif
|
|
|
|
#endif
|
|
#endif
|
|
diff --git core/base/file.cpp core/base/file.cpp
|
|
index da1adba..7ba6d23 100644
|
|
--- core/base/file.cpp
|
|
+++ core/base/file.cpp
|
|
@@ -111,7 +111,7 @@ bool WriteStringToFile(const std::string& content, const std::string& path,
|
|
|
|
bool WriteStringToFile(const std::string& content, const std::string& path) {
|
|
int flags = O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW | O_BINARY;
|
|
- int fd = TEMP_FAILURE_RETRY(open(path.c_str(), flags, DEFFILEMODE));
|
|
+ int fd = TEMP_FAILURE_RETRY(open(path.c_str(), flags, (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)));
|
|
if (fd == -1) {
|
|
return false;
|
|
}
|
|
diff --git core/adb/sysdeps.h core/adb/sysdeps.h
|
|
index 75dcc86..2dba172 100644
|
|
--- core/adb/sysdeps.h
|
|
+++ core/adb/sysdeps.h
|
|
@@ -757,18 +757,7 @@ static __inline__ int adb_thread_setname(const std::string& name) {
|
|
#ifdef __APPLE__
|
|
return pthread_setname_np(name.c_str());
|
|
#else
|
|
- const char *s = name.c_str();
|
|
-
|
|
- // pthread_setname_np fails rather than truncating long strings.
|
|
- const int max_task_comm_len = 16; // including the null terminator
|
|
- if (name.length() > (max_task_comm_len - 1)) {
|
|
- char buf[max_task_comm_len];
|
|
- strncpy(buf, name.c_str(), sizeof(buf) - 1);
|
|
- buf[sizeof(buf) - 1] = '\0';
|
|
- s = buf;
|
|
- }
|
|
-
|
|
- return pthread_setname_np(pthread_self(), s) ;
|
|
+ return 0;
|
|
#endif
|
|
}
|
|
|
|
diff --git core/adb/diagnose_usb.cpp core/adb/diagnose_usb.cpp
|
|
index 0f067b0..1138f8d 100644
|
|
--- core/adb/diagnose_usb.cpp
|
|
+++ core/adb/diagnose_usb.cpp
|
|
@@ -32,28 +32,7 @@ static const char kPermissionsHelpUrl[] = "http://developer.android.com/tools/de
|
|
// Returns a message describing any potential problems we find with udev, or nullptr if we can't
|
|
// find plugdev information (i.e. udev is not installed).
|
|
static const char* GetUdevProblem() {
|
|
-#if defined(__linux__)
|
|
- errno = 0;
|
|
- group* plugdev_group = getgrnam("plugdev");
|
|
-
|
|
- if (plugdev_group == nullptr) {
|
|
- if (errno != 0) {
|
|
- perror("failed to read plugdev group info");
|
|
- }
|
|
- // We can't give any generally useful advice here, just let the caller print the help URL.
|
|
- return nullptr;
|
|
- }
|
|
-
|
|
- // getgroups(2) indicates that the group_member() may not check the egid so we check it
|
|
- // additionally just to be sure.
|
|
- if (group_member(plugdev_group->gr_gid) || getegid() == plugdev_group->gr_gid) {
|
|
- // The user is in plugdev so the problem is likely with the udev rules.
|
|
- return "verify udev rules";
|
|
- }
|
|
- return "udev requires plugdev group membership";
|
|
-#else
|
|
return nullptr;
|
|
-#endif
|
|
}
|
|
|
|
// Short help text must be a single line, and will look something like:
|
|
diff --git core/fastboot/socket.cpp core/fastboot/socket.cpp
|
|
index 14ecd93..aff905c 100644
|
|
--- core/fastboot/socket.cpp
|
|
+++ core/fastboot/socket.cpp
|
|
@@ -31,6 +31,8 @@
|
|
#include <android-base/errors.h>
|
|
#include <android-base/stringprintf.h>
|
|
|
|
+#include <sys/select.h>
|
|
+
|
|
Socket::Socket(cutils_socket_t sock) : sock_(sock) {}
|
|
|
|
Socket::~Socket() {
|