Internal plugin initalizers must now be prefixed with wofi_. This prevents using map, wl_list, wofi, and other mode strings to segfault wofi
This commit is contained in:
		| @@ -17,7 +17,7 @@ | |||||||
|  |  | ||||||
| #include <wofi.h> | #include <wofi.h> | ||||||
|  |  | ||||||
| void dmenu_init() { | void wofi_dmenu_init() { | ||||||
| 	struct map* cached = map_init(); | 	struct map* cached = map_init(); | ||||||
| 	struct wl_list* cache = wofi_read_cache("dmenu"); | 	struct wl_list* cache = wofi_read_cache("dmenu"); | ||||||
|  |  | ||||||
| @@ -48,11 +48,11 @@ void dmenu_init() { | |||||||
| 	map_free(cached); | 	map_free(cached); | ||||||
| } | } | ||||||
|  |  | ||||||
| void dmenu_exec(const gchar* cmd) { | void wofi_dmenu_exec(const gchar* cmd) { | ||||||
| 	printf("%s\n", cmd); | 	printf("%s\n", cmd); | ||||||
| 	exit(0); | 	exit(0); | ||||||
| } | } | ||||||
|  |  | ||||||
| bool dmenu_exec_search() { | bool wofi_dmenu_exec_search() { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -99,7 +99,7 @@ static void insert_dir(char* app_dir, struct map* cached, struct map* entries) { | |||||||
| 	closedir(dir); | 	closedir(dir); | ||||||
| } | } | ||||||
|  |  | ||||||
| void drun_init() { | void wofi_drun_init() { | ||||||
| 	struct map* cached = map_init(); | 	struct map* cached = map_init(); | ||||||
| 	struct map* entries = map_init(); | 	struct map* entries = map_init(); | ||||||
| 	struct wl_list* cache = wofi_read_cache("drun"); | 	struct wl_list* cache = wofi_read_cache("drun"); | ||||||
| @@ -160,7 +160,7 @@ static void launch_done(GObject* obj, GAsyncResult* result, gpointer data) { | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| void drun_exec(const gchar* cmd) { | void wofi_drun_exec(const gchar* cmd) { | ||||||
| 	GDesktopAppInfo* info = g_desktop_app_info_new_from_filename(cmd); | 	GDesktopAppInfo* info = g_desktop_app_info_new_from_filename(cmd); | ||||||
| 	if(G_IS_DESKTOP_APP_INFO(info)) { | 	if(G_IS_DESKTOP_APP_INFO(info)) { | ||||||
| 		g_app_info_launch_uris_async(G_APP_INFO(info), NULL, NULL, NULL, launch_done, (gchar*) cmd); | 		g_app_info_launch_uris_async(G_APP_INFO(info), NULL, NULL, NULL, launch_done, (gchar*) cmd); | ||||||
|   | |||||||
| @@ -17,7 +17,7 @@ | |||||||
|  |  | ||||||
| #include <wofi.h> | #include <wofi.h> | ||||||
|  |  | ||||||
| void run_init() { | void wofi_run_init() { | ||||||
| 	struct map* cached = map_init(); | 	struct map* cached = map_init(); | ||||||
| 	struct wl_list* cache = wofi_read_cache("run"); | 	struct wl_list* cache = wofi_read_cache("run"); | ||||||
|  |  | ||||||
| @@ -66,7 +66,7 @@ void run_init() { | |||||||
| 	map_free(cached); | 	map_free(cached); | ||||||
| } | } | ||||||
|  |  | ||||||
| void run_exec(const gchar* cmd) { | void wofi_run_exec(const gchar* cmd) { | ||||||
| 	if(wofi_run_in_term()) { | 	if(wofi_run_in_term()) { | ||||||
| 		wofi_term_run(cmd); | 		wofi_term_run(cmd); | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -394,7 +394,7 @@ static gboolean key_press(GtkWidget* widget, GdkEvent* event, gpointer data) { | |||||||
| } | } | ||||||
|  |  | ||||||
| static void* get_plugin_proc(const char* prefix, const char* suffix) { | static void* get_plugin_proc(const char* prefix, const char* suffix) { | ||||||
| 	char* proc_name = utils_concat(2, prefix, suffix); | 	char* proc_name = utils_concat(3, "wofi_", prefix, suffix); | ||||||
| 	void* proc = dlsym(RTLD_DEFAULT, proc_name); | 	void* proc = dlsym(RTLD_DEFAULT, proc_name); | ||||||
| 	free(proc_name); | 	free(proc_name); | ||||||
| 	return proc; | 	return proc; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Scoopta
					Scoopta