* Clean up. Preserve errno for the caller's convenience. */
| 352 | * Clean up. Preserve errno for the caller's convenience. |
| 353 | */ |
| 354 | void |
| 355 | pw_fini(void) |
| 356 | { |
| 357 | int serrno, status; |
| 358 | |
| 359 | if (!initialized) |
| 360 | return; |
| 361 | initialized = 0; |
| 362 | serrno = errno; |
| 363 | if (editpid != -1) { |
| 364 | kill(editpid, SIGTERM); |
| 365 | kill(editpid, SIGCONT); |
| 366 | waitpid(editpid, &status, 0); |
| 367 | editpid = -1; |
| 368 | } |
| 369 | if (*tempname != '\0') { |
| 370 | unlink(tempname); |
| 371 | *tempname = '\0'; |
| 372 | } |
| 373 | if (lockfd != -1) |
| 374 | close(lockfd); |
| 375 | errno = serrno; |
| 376 | } |
| 377 | |
| 378 | /* |
| 379 | * Compares two struct pwds. |