- if (inplace) {
- if ((tmpfd = open(tmpfil, O_RDONLY)) == NOTOK)
- adios(tmpfil, "unable to open for re-reading");
-
- lseek(fd, (off_t) 0, SEEK_SET);
-
- /*
- ** We're making the file shorter if we're deleting a
- ** header field so the file has to be truncated or it
- ** will contain garbage.
- */
-
- if (delete >= -1 && ftruncate(fd, 0) == -1)
- adios(tmpfil, "unable to truncate.");
-
- cpydata(tmpfd, fd, tmpfil, file);
- close(tmpfd);
- unlink(tmpfil);
- } else {
- strncpy(buffer, m_backup(file), sizeof(buffer));
- if (rename(file, buffer) == NOTOK) {
- switch (errno) {
- case ENOENT: /* unlinked early - no annotations */
- unlink(tmpfil);
- break;
+ if ((tmpfd = open(tmpfil, O_RDONLY)) == NOTOK) {
+ adios(tmpfil, "unable to open for re-reading");
+ }
+ lseek(fd, (off_t) 0, SEEK_SET);