Minor cleanup

This commit is contained in:
topjohnwu 2018-11-08 15:23:36 -05:00
parent 4cdd66ceff
commit 5743c72cca
5 changed files with 5 additions and 33 deletions

View File

@ -362,9 +362,7 @@ static void simple_mount(const char *path) {
if (access(buf2, F_OK) == -1) if (access(buf2, F_OK) == -1)
continue; continue;
if (entry->d_type == DT_DIR) { if (entry->d_type == DT_DIR) {
char *new_path = strdup2(buf2); simple_mount(CharArray(buf2));
simple_mount(new_path);
delete [] new_path;
} else if (entry->d_type == DT_REG) { } else if (entry->d_type == DT_REG) {
// Actual file path // Actual file path
snprintf(buf, PATH_MAX, "%s%s", SIMPLEMOUNT, buf2); snprintf(buf, PATH_MAX, "%s%s", SIMPLEMOUNT, buf2);

View File

@ -9,10 +9,6 @@
#include <sys/un.h> #include <sys/un.h>
#include <sys/socket.h> #include <sys/socket.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int setup_done; extern int setup_done;
extern int seperate_vendor; extern int seperate_vendor;
@ -88,8 +84,4 @@ void magiskhide_handler(int client);
void su_daemon_handler(int client, struct ucred *credential); void su_daemon_handler(int client, struct ucred *credential);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -1,10 +1,6 @@
#ifndef IMG_H #ifndef IMG_H
#define IMG_H #define IMG_H
#ifdef __cplusplus
extern "C" {
#endif
int create_img(const char *img, int size); int create_img(const char *img, int size);
int resize_img(const char *img, int size); int resize_img(const char *img, int size);
char *mount_image(const char *img, const char *target); char *mount_image(const char *img, const char *target);
@ -12,8 +8,4 @@ int umount_image(const char *target, const char *device);
int merge_img(const char *source, const char *target); int merge_img(const char *source, const char *target);
int trim_img(const char *img, const char *mount, char *loop); int trim_img(const char *img, const char *mount, char *loop);
#ifdef __cplusplus
}
#endif
#endif //IMG_H #endif //IMG_H

View File

@ -6,10 +6,6 @@
#include "logging.h" #include "logging.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MAIN_SOCKET "d30138f2310a9fb9c54a3e0c21f58591" #define MAIN_SOCKET "d30138f2310a9fb9c54a3e0c21f58591"
#define LOG_SOCKET "5864cd77f2f8c59b3882e2d35dbf51e4" #define LOG_SOCKET "5864cd77f2f8c59b3882e2d35dbf51e4"
#define JAVA_PACKAGE_NAME "com.topjohnwu.magisk" #define JAVA_PACKAGE_NAME "com.topjohnwu.magisk"
@ -45,10 +41,8 @@ extern "C" {
extern char *argv0; /* For changing process name */ extern char *argv0; /* For changing process name */
#define applet_names ((const char *[]) { "magisk", "su", "resetprop", "magiskhide", "imgtool", NULL }) #define applet_names ((const char *[]) { "magisk", "su", "resetprop", "magiskhide", "imgtool", nullptr })
#define init_applet ((const char *[]) { "magiskpolicy", "supolicy", NULL }) #define init_applet ((const char *[]) { "magiskpolicy", "supolicy", nullptr })
extern int (*applet_main[]) (int, char *[]);
// Multi-call entrypoints // Multi-call entrypoints
int magisk_main(int argc, char *argv[]); int magisk_main(int argc, char *argv[]);
@ -58,8 +52,4 @@ int su_client_main(int argc, char *argv[]);
int resetprop_main(int argc, char *argv[]); int resetprop_main(int argc, char *argv[]);
int imgtool_main(int argc, char *argv[]); int imgtool_main(int argc, char *argv[]);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -7,8 +7,8 @@
#include "magisk.h" #include "magisk.h"
#include "selinux.h" #include "selinux.h"
int (*applet_main[]) (int, char *[]) = static int (*applet_main[]) (int, char *[]) =
{ magisk_main, su_client_main, resetprop_main, magiskhide_main, imgtool_main, NULL }; { magisk_main, su_client_main, resetprop_main, magiskhide_main, imgtool_main, nullptr };
char *argv0; char *argv0;