| 358 | } |
| 359 | |
| 360 | int delete_tempfile(struct tempfile **tempfile_p) |
| 361 | { |
| 362 | struct tempfile *tempfile = *tempfile_p; |
| 363 | int err = 0; |
| 364 | |
| 365 | if (!is_tempfile_active(tempfile)) |
| 366 | return 0; |
| 367 | |
| 368 | err |= close_tempfile_gently(tempfile); |
| 369 | err |= unlink_or_warn(tempfile->filename.buf); |
| 370 | err |= remove_template_directory(tempfile, 0); |
| 371 | deactivate_tempfile(tempfile); |
| 372 | *tempfile_p = NULL; |
| 373 | |
| 374 | return err ? -1 : 0; |
| 375 | } |
| 376 | |
| 377 | void reassign_tempfile_ownership(pid_t from, pid_t to) |
| 378 | { |