Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 423016 Details for
Bug 555436
kde-base/pykde4 patch gets fork() backwards and subtly breaks DBus
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
kpythonpluginfactorywrapper.c-r2
kpythonpluginfactorywrapper.c-r1 (text/x-csrc), 1.42 KB, created by
Hector Martin
on 2016-01-16 04:37:06 UTC
(
hide
)
Description:
kpythonpluginfactorywrapper.c-r2
Filename:
MIME Type:
Creator:
Hector Martin
Created:
2016-01-16 04:37:06 UTC
Size:
1.42 KB
patch
obsolete
>#include <dlfcn.h> >#include <stdio.h> >#include <stdlib.h> >#include <string.h> >#include <unistd.h> > >#define VERSION_LEN 10 > >#define FORMAT EPREFIX PLUGIN_DIR "/kpython%spluginfactory.so" > >static void *handle; >static void *(*wrapped_qt_plugin_instance)(); > >static void get_python_version(char* out) { > int pipefd[2]; > pipe(pipefd); > pid_t cpid = fork(); > if (cpid > 0) { > close(pipefd[1]); > read(pipefd[0], out, VERSION_LEN); > close(pipefd[0]); > } else if (cpid < 0) { > /* fork failed, guess 2.7 */ > strcpy(out, "2.7\n"); > close(pipefd[0]); > close(pipefd[1]); > } else { > close(pipefd[0]); > close(1); > dup2(pipefd[1], 1); > close(pipefd[1]); > close(0); > char *args[] = { "eselect", "python", "show", "--ABI", "--python2", 0 }; > execv(EPREFIX "/usr/bin/eselect", args); > /* exec failed, guess 2.7 */ > write(1, "2.7\n", 4); > exit(0); > } >} > >__attribute__((constructor)) >static void init() { > char buf[VERSION_LEN + 1]; > memset(buf, 0, VERSION_LEN + 1); > get_python_version(buf); > char *s = buf; > while(*s != '\0') { > if(*s == '\n') { > *s = '\0'; > break; > } > ++s; > } > int length = strlen(FORMAT) + strlen(buf) + 1; > char *name = malloc(length + 1); > snprintf(name, length, FORMAT, buf); > handle = dlopen(name, RTLD_NOW); > free(name); > wrapped_qt_plugin_instance = dlsym(handle, "qt_plugin_instance"); >} > >__attribute__((destructor)) >static void fini() { > dlclose(handle); >} > >void *qt_plugin_instance() { > return wrapped_qt_plugin_instance(); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 555436
: 423016