Showing the changes to sysmisc.c (1 of 1 file). Show all
Unified · Split
| @@ -288,35 +288,25 @@ Conf_save_start_error conf_save_start(Conf_save *p, · 287 unmodified lines | |||
| 288 | err = Conf_save_start_no_home; | 288 | err = Conf_save_start_no_home; |
| 289 | goto cleanup; | 289 | goto cleanup; |
| 290 | } | 290 | } |
| 291 | if (!dir) { | 291 | if (!dir) |
| 292 | err = Conf_save_start_alloc_failed; | 292 | goto allocfail; |
| 293 | goto cleanup; | ||
| 294 | } | ||
| 295 | osoputoso(&p->canonpath, dir); | 293 | osoputoso(&p->canonpath, dir); |
| 296 | if (!p->canonpath) { | 294 | if (!p->canonpath) |
| 297 | err = Conf_save_start_alloc_failed; | 295 | goto allocfail; |
| 298 | goto cleanup; | ||
| 299 | } | ||
| 300 | size_t namelen = strlen(conf_file_name); | 296 | size_t namelen = strlen(conf_file_name); |
| 301 | if (namelen == 0) { | 297 | if (namelen == 0) { |
| 302 | err = Conf_save_start_bad_conf_name; | 298 | err = Conf_save_start_bad_conf_name; |
| 303 | goto cleanup; | 299 | goto cleanup; |
| 304 | } | 300 | } |
| 305 | conf_impl_catconfpath(&p->canonpath, conf_file_name, namelen); | 301 | conf_impl_catconfpath(&p->canonpath, conf_file_name, namelen); |
| 306 | if (!p->canonpath) { | 302 | if (!p->canonpath) |
| 307 | err = Conf_save_start_alloc_failed; | 303 | goto allocfail; |
| 308 | goto cleanup; | ||
| 309 | } | ||
| 310 | osoputoso(&p->temppath, p->canonpath); | 304 | osoputoso(&p->temppath, p->canonpath); |
| 311 | if (!p->temppath) { | 305 | if (!p->temppath) |
| 312 | err = Conf_save_start_alloc_failed; | 306 | goto allocfail; |
| 313 | goto cleanup; | ||
| 314 | } | ||
| 315 | osocat(&p->temppath, ".tmp"); | 307 | osocat(&p->temppath, ".tmp"); |
| 316 | if (!p->temppath) { | 308 | if (!p->temppath) |
| 317 | err = Conf_save_start_alloc_failed; | 309 | goto allocfail; |
| 318 | goto cleanup; | ||
| 319 | } | ||
| 320 | // Remove old temp file if it exists. If it exists and we can't remove it, | 310 | // Remove old temp file if it exists. If it exists and we can't remove it, |
| 321 | // error. | 311 | // error. |
| 322 | if (unlink(osoc(p->temppath)) == -1 && errno != ENOENT) { | 312 | if (unlink(osoc(p->temppath)) == -1 && errno != ENOENT) { |
| @@ -350,6 +340,8 @@ Conf_save_start_error conf_save_start(Conf_save *p, · 27 unmodified lines | |||
| 350 | osofree(dir); | 340 | osofree(dir); |
| 351 | return Conf_save_start_ok; | 341 | return Conf_save_start_ok; |
| 352 | 342 | ||
| 343 | allocfail: | ||
| 344 | err = Conf_save_start_alloc_failed; | ||
| 353 | cleanup: | 345 | cleanup: |
| 354 | osofree(dir); | 346 | osofree(dir); |
| 355 | conf_save_cancel(p); | 347 | conf_save_cancel(p); |