Merge "nativeloader: Add CloseNativeLibrary() method" into nyc-dev
diff --git a/adb/commandline.cpp b/adb/commandline.cpp
index 0c5be84..39fe3c4 100644
--- a/adb/commandline.cpp
+++ b/adb/commandline.cpp
@@ -1175,7 +1175,11 @@
// Zipped bugreport option - will call 'bugreportz', which prints the location of the generated
// file, then pull it to the destination file provided by the user.
- const char* dest_file = argv[1];
+ std::string dest_file = argv[1];
+ if (!android::base::EndsWith(argv[1], ".zip")) {
+ // TODO: use a case-insensitive comparison (like EndsWithIgnoreCase
+ dest_file += ".zip";
+ }
std::string output;
int status = send_shell_command(transport_type, serial, "bugreportz", true, &output);
@@ -1185,9 +1189,9 @@
if (android::base::StartsWith(output, BUGZ_OK_PREFIX)) {
const char* zip_file = &output[strlen(BUGZ_OK_PREFIX)];
std::vector<const char*> srcs{zip_file};
- status = do_sync_pull(srcs, dest_file, true, dest_file) ? 0 : 1;
+ status = do_sync_pull(srcs, dest_file.c_str(), true, dest_file.c_str()) ? 0 : 1;
if (status != 0) {
- fprintf(stderr, "Could not copy file '%s' to '%s'\n", zip_file, dest_file);
+ fprintf(stderr, "Could not copy file '%s' to '%s'\n", zip_file, dest_file.c_str());
}
return status;
}
diff --git a/fs_mgr/fs_mgr.c b/fs_mgr/fs_mgr.c
index 70acd38..6de8817 100644
--- a/fs_mgr/fs_mgr.c
+++ b/fs_mgr/fs_mgr.c
@@ -602,6 +602,10 @@
/* Let's replay the mount actions. */
i = top_idx - 1;
continue;
+ } else {
+ ERROR("%s(): Format failed. Suggest recovery...\n", __func__);
+ encryptable = FS_MGR_MNTALL_DEV_NEEDS_RECOVERY;
+ continue;
}
}
if (mret && mount_errno != EBUSY && mount_errno != EACCES &&
diff --git a/init/builtins.cpp b/init/builtins.cpp
index b77f9ad..1381d7c 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -29,6 +29,7 @@
#include <sys/socket.h>
#include <sys/mount.h>
#include <sys/resource.h>
+#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -65,19 +66,20 @@
#define UNMOUNT_CHECK_MS 5000
#define UNMOUNT_CHECK_TIMES 10
-// System call provided by bionic but not in any header file.
-extern "C" int init_module(void *, unsigned long, const char *);
-
static const int kTerminateServiceDelayMicroSeconds = 50000;
static int insmod(const char *filename, const char *options) {
- std::string module;
- if (!read_file(filename, &module)) {
+ int fd = open(filename, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
+ if (fd == -1) {
+ ERROR("insmod: open(\"%s\") failed: %s", filename, strerror(errno));
return -1;
}
-
- // TODO: use finit_module for >= 3.8 kernels.
- return init_module(&module[0], module.size(), options);
+ int rc = syscall(__NR_finit_module, fd, options, 0);
+ if (rc == -1) {
+ ERROR("finit_module for \"%s\" failed: %s", filename, strerror(errno));
+ }
+ close(fd);
+ return rc;
}
static int __ifupdown(const char *interface, int up) {