return status;
}
+static void xunlink(const char *path, const char *what) {
+ int r= unlink(path);
+ if (r) sysdie("can't unlink %s %s", path, what);
+}
+
static void check_isreg(const struct stat *stab, const char *path,
const char *what) {
if (!S_ISREG(stab->st_mode))
if (r) sysdie("link feedfile %s to flushing file %s", feedfile, dut_path);
/* => Hardlinked */
- r= unlink(feedfile);
- if (r) sysdie("unlink old feedfile link %s", feedfile);
+ xunlink(feedfile, "old feedfile link");
/* => Moved */
spawn_inndcomm_flush(); /* => Flushing, sets sms to sm_FLUSHING */
open_defer(); /* so that we will later close it and rename it */
break;
case 2:
- if (unlink(path_defer))
- sysdie("could not unlink stale defer file link %s (presumably"
- " hardlink to backlog file)", path_defer);
+ xunlink(path_defer, "stale defer file link"
+ " (presumably hardlink to backlog file)");
break;
default:
die("defer file %s has unexpected link count %d",
if (samefile(&stab_d, &stab_f)) {
debug("startup: F==D => Hardlinked");
- r= unlink(path_flushing);
- if (r) sysdie("unlink feed file %s during startup", feedfile);
+ xunlink(path_flushing, "feed file (during startup)");
found_moved:
debug(" => Moved");
startup_set_input_file(file_d);
close_defer();
- if (unlink(path_flushing))
- sysdie("could not unlink old flushing file %s", path_flushing);
+ xunlink(path_flushing, "old flushing file");
if (sms==sm_DROPPING) {
if (search_backlog_file()) {
return;
}
notice("feed dropped and our work is complete");
- r= unlink(path_lock);
- if (r) sysdie("unlink lockfile for old feed %s", path_lock);
+ xunlink(path_lock, "lockfile for old feed");
exit(0);
}