mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-08 06:31:58 +00:00
better magic plugin loading on binary_path
This commit is contained in:
@@ -439,10 +439,9 @@ void log_syslog(char *syslog_opts) {
|
||||
|
||||
char *uwsgi_get_cwd() {
|
||||
|
||||
int newsize = 256;
|
||||
char *cwd;
|
||||
size_t newsize = 256;
|
||||
|
||||
cwd = uwsgi_malloc(newsize);
|
||||
char *cwd = uwsgi_malloc(newsize);
|
||||
|
||||
if (getcwd(cwd, newsize) == NULL) {
|
||||
newsize = errno;
|
||||
|
||||
@@ -942,11 +942,13 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
|
||||
//initialize embedded plugins
|
||||
UWSGI_LOAD_EMBEDDED_PLUGINS
|
||||
// now a bit of magic, if the argv[0] basename contains a 'uwsgi_' string,
|
||||
// now a bit of magic, if the executable basename contains a 'uwsgi_' string,
|
||||
// try to automatically load a plugin
|
||||
//uwsgi_log("executable name: %s\n", argv[0]);
|
||||
char *p = strrchr(argv[0], '/');
|
||||
if (p == NULL) p = argv[0];
|
||||
#ifdef UWSGI_DEBUG
|
||||
uwsgi_log("executable name: %s\n", uwsgi.binary_path);
|
||||
#endif
|
||||
char *p = strrchr(uwsgi.binary_path, '/');
|
||||
if (p == NULL) p = uwsgi.binary_path;
|
||||
p = strstr(p, "uwsgi_");
|
||||
if (p != NULL) {
|
||||
plugins_requested = strchr(p, '_');
|
||||
@@ -965,6 +967,7 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
p = strtok(NULL, ",");
|
||||
}
|
||||
}
|
||||
|
||||
build_options();
|
||||
|
||||
if (gethostname(uwsgi.hostname, 255)) {
|
||||
@@ -972,7 +975,6 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
}
|
||||
uwsgi.hostname_len = strlen(uwsgi.hostname);
|
||||
|
||||
|
||||
uwsgi.magic_table['v'] = uwsgi.cwd;
|
||||
uwsgi.magic_table['h'] = uwsgi.hostname;
|
||||
|
||||
@@ -1201,6 +1203,7 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
|
||||
// ok, the options dictionary is available, lets manage it
|
||||
|
||||
|
||||
uwsgi_configure();
|
||||
|
||||
/* uWSGI IS CONFIGURED !!! */
|
||||
@@ -3491,9 +3494,12 @@ void build_options() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (short_options) {
|
||||
free(short_options);
|
||||
}
|
||||
|
||||
|
||||
short_options = uwsgi_malloc(short_opt_size + 1);
|
||||
memcpy(short_options, base_short_options, strlen(base_short_options));
|
||||
so_ptr = short_options + strlen(base_short_options);
|
||||
|
||||
Reference in New Issue
Block a user