Changeset 11854
- Timestamp:
- Feb 16, 2007, 12:17:05 PM (19 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 2 edited
-
pxinject.c (modified) (3 diffs)
-
pxinjectConfig.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pxinject.c
r11702 r11854 44 44 45 45 pxConfig *config = pxinjectConfig(NULL, argc, argv); 46 if (!config) { 47 psError(PXTOOLS_ERR_CONFIG, false, "failed to configure"); 48 goto FAIL; 49 } 46 50 47 51 switch (config->mode) { … … 60 64 FAIL: 61 65 psErrorStackPrint (stderr, "failure\n"); 66 int exit_status = pxerrorGetExitStatus(); 62 67 63 68 psFree(config); … … 65 70 psLibFinalize(); 66 71 67 exit( EXIT_FAILURE);72 exit(exit_status); 68 73 } 69 74 -
trunk/ippTools/src/pxinjectConfig.c
r11142 r11854 27 27 #include "pxinject.h" 28 28 29 // this function can not fail -- exits on error 30 pxConfig *pxinjectConfig(pxConfig *config, int argc, char **argv){29 pxConfig *pxinjectConfig(pxConfig *config, int argc, char **argv) 30 { 31 31 if (!config) { 32 32 config = pxConfigAlloc(); … … 39 39 if (!config->modules) { 40 40 psError(PS_ERR_UNKNOWN, false, "Can't find site configuration"); 41 goto FAIL; 41 psFree(config); 42 return NULL; 42 43 } 43 44 … … 105 106 psFree(newImfileArgs); 106 107 107 goto FAIL; 108 psFree(config); 109 return NULL; 108 110 } 109 111 … … 119 121 if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\ 120 122 psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \ 121 goto FAIL; \ 123 psFree(config); \ 124 return NULL; \ 122 125 } \ 123 126 } \ … … 134 137 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "iteration", 0, "==", n)) { 135 138 psError(PS_ERR_UNKNOWN, false, "failed to add item iteration"); 136 goto FAIL; 139 psFree(config); 140 return NULL; 137 141 } 138 142 } … … 148 152 if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) { 149 153 psError(PS_ERR_UNKNOWN, false, "failed to add item camera"); 150 goto FAIL; 154 psFree(config); 155 return NULL; 151 156 } 152 157 } … … 159 164 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "imfiles", 0, "==", n)) { 160 165 psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles"); 161 goto FAIL; 166 psFree(config); 167 return NULL; 162 168 } 163 169 } … … 172 178 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p1_version", 0, "==", n)) { 173 179 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version"); 174 goto FAIL; 180 psFree(config); 181 return NULL; 175 182 } 176 183 } … … 183 190 if (!psMetadataAddBool(config->where, PS_LIST_TAIL, "accept", 0, "==", boolean)) { 184 191 psError(PS_ERR_UNKNOWN, false, "failed to add item accept"); 185 goto FAIL; 192 psFree(config); 193 return NULL; 186 194 } 187 195 } … … 199 207 if (!config->dbh) { 200 208 psError(PS_ERR_UNKNOWN, false, "Can't configure database"); 201 goto FAIL; 209 psFree(config); 210 return NULL; 202 211 } 203 212 … … 207 216 208 217 return config; 209 210 FAIL:211 psFree(config);212 pmConfigDone();213 psLibFinalize();214 exit(EXIT_FAILURE);215 218 }
Note:
See TracChangeset
for help on using the changeset viewer.
