Ticket #174: run_email2trac.c-set_python_egg_cache_env.diff
File run_email2trac.c-set_python_egg_cache_env.diff, 1.4 KB (added by pepl@…, 14 years ago) |
---|
-
run_email2trac.c
old new 55 55 int status; 56 56 57 57 char **trac_script_args; 58 char *python_egg_cache; 58 59 struct passwd *TRAC; 59 60 struct passwd *MTA; 60 61 struct stat script_attrs; … … 79 80 i++; 80 81 continue; 81 82 } 83 else if ( (strcmp(argv[i],"--eggcache") == 0) || 84 (strcmp(argv[i],"-e") == 0) ) { 85 i++; 86 python_egg_cache = argv[i]; 87 continue; 88 } 82 89 83 90 trac_script_args[j] = argv[i]; 84 91 j++; 85 92 } 86 93 trac_script_args[j] = NULL; 87 94 88 89 95 /* Check caller */ 90 91 92 96 check_username(MTA_USER); 93 97 MTA = getpwnam(MTA_USER); 94 98 … … 102 106 return -2; /* 254 : Invalid caller */ 103 107 } 104 108 105 106 109 /* set UID/GID to Trac (or apache) user */ 107 110 check_username(TRAC_USER); 108 111 if ( TRAC = getpwnam(TRAC_USER) ) { … … 121 124 return -4; /* 252 : script not found */ 122 125 } 123 126 127 /* Set PYTHON_EGG_CACHE env variable if we have been told to do so */ 128 if ( strlen(python_egg_cache) > 0 ) { 129 setenv("PYTHON_EGG_CACHE",python_egg_cache ,1); 130 } 131 124 132 /* Execute script */ 125 133 status = execv(trac_script, trac_script_args); 134 126 135 if ( DEBUG ) printf("Script %s execution failure (error=%d). Check permission and interpreter path.\n",trac_script,status); 127 136 return -1; /* 255 : should never reach this point */ 128 137