/* Exit on error. */
if (rc) {
fsm->postpone = 1;
- (void) fsmNext(fsm, FSM_UNDO);
break;
}
}
if (rc) {
- (void) fsmNext(fsm, FSM_UNDO);
+ if (!fsm->postpone) {
+ /* XXX only erase if temp fn w suffix is in use */
+ if (fsm->suffix) {
+ if (S_ISDIR(st->st_mode)) {
+ (void) fsmRmdir(fsm->path);
+ } else {
+ (void) fsmUnlink(fsm->path, fsm->mapFlags);
+ }
+ }
+ errno = saveerrno;
+ if (fsm->failedFile && *fsm->failedFile == NULL)
+ *fsm->failedFile = xstrdup(fsm->path);
+ }
+
break;
}
/* Exit on error. */
if (rc) {
fsm->postpone = 1;
- (void) fsmNext(fsm, FSM_UNDO);
break;
}
}
if (rc) {
- (void) fsmNext(fsm, FSM_UNDO);
+ if (!fsm->postpone) {
+ if (fsm->failedFile && *fsm->failedFile == NULL)
+ *fsm->failedFile = xstrdup(fsm->path);
+ }
+
break;
}
}
break;
case FSM_POST:
break;
- case FSM_UNDO:
- if (fsm->postpone)
- break;
- if (fsm->goal == FSM_PKGINSTALL) {
- /* XXX only erase if temp fn w suffix is in use */
- if (fsm->suffix) {
- if (S_ISDIR(st->st_mode)) {
- (void) fsmRmdir(fsm->path);
- } else {
- (void) fsmUnlink(fsm->path, fsm->mapFlags);
- }
- }
- errno = saveerrno;
- }
- if (fsm->failedFile && *fsm->failedFile == NULL)
- *fsm->failedFile = xstrdup(fsm->path);
- break;
default:
break;
}