rdbuf = fsm->rdbuf;
fsm->rdbuf = (char *) mapped;
fsm->rdlen = nmapped = st->st_size;
+#if defined(MADV_DONTNEED)
xx = madvise(mapped, nmapped, MADV_DONTNEED);
+#endif
}
#endif
#if HAVE_MMAP
if (mapped != (void *)-1) {
xx = msync(mapped, nmapped, MS_ASYNC);
+#if defined(MADV_DONTNEED)
+ xx = madvise(mapped, nmapped, MADV_DONTNEED);
+#endif
/*@-noeffect@*/ xx = munmap(mapped, nmapped) /*@=noeffect@*/;
fsm->rdbuf = rdbuf;
}
}
#endif
+#define IS_DEV_LOG(_x) \
+ ((_x) != NULL && strlen(_x) >= (sizeof("/dev/log")-1) && \
+ !strncmp((_x), "/dev/log", sizeof("/dev/log")-1) && \
+ ((_x)[sizeof("/dev/log")-1] == '\0' || \
+ (_x)[sizeof("/dev/log")-1] == ';'))
+
/*@-compmempass@*/
int fsmStage(FSM_t fsm, fileStage stage)
{
rc = fsmStage(fsm, FSM_MKNOD);
} else {
/* XXX Special case /dev/log, which shouldn't be packaged anyways */
- if (strncmp(fsm->path, "/dev/log;", sizeof("/dev/log;")-1))
+ if (!IS_DEV_LOG(fsm->path))
rc = CPIOERR_UNKNOWN_FILETYPE;
}
if (!S_ISDIR(st->st_mode) && st->st_nlink > 1) {
}
/* XXX Special case /dev/log, which shouldn't be packaged anyways */
- if (!S_ISSOCK(st->st_mode)
- && strncmp(fsm->path, "/dev/log;", sizeof("/dev/log;")-1))
- {
+ if (!S_ISSOCK(st->st_mode) && !IS_DEV_LOG(fsm->path)) {
/* Rename temporary to final file name. */
if (!S_ISDIR(st->st_mode) &&
(fsm->subdir || fsm->suffix || fsm->nsuffix))
(psm->failedFile != NULL ? psm->failedFile : ""),
cpioStrerror(rc));
rc = RPMRC_FAIL;
+
+ /* XXX notify callback on error. */
+ psm->what = RPMCALLBACK_UNPACK_ERROR;
+ psm->amount = 0;
+ psm->total = 0;
+ xx = psmStage(psm, PSM_NOTIFY);
+
break;
}
psm->what = RPMCALLBACK_INST_PROGRESS;
else
rpmError(RPMERR_CPIO, _("%s failed: %s\n"),
psm->stepName, cpioStrerror(rc));
+
+ /* XXX notify callback on error. */
+ psm->what = RPMCALLBACK_CPIO_ERROR;
+ psm->amount = 0;
+ psm->total = 0;
+ xx = psmStage(psm, PSM_NOTIFY);
}
if (fi->h && (psm->goal == PSM_PKGERASE || psm->goal == PSM_PKGSAVE))