chiark
/
gitweb
/
~ian
/
innduct.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
replace most calls to unlink/sysdie with xunlink
[innduct.git]
/
backends
/
innduct.c
diff --git
a/backends/innduct.c
b/backends/innduct.c
index 27fba9005c0f6e795b2aa214611c53f166f38db1..9fcd2ff04ab0a3309bf4813a5102f65c6e59926a 100644
(file)
--- a/
backends/innduct.c
+++ b/
backends/innduct.c
@@
-382,6
+382,11
@@
static int xwaitpid(pid_t *pid, const char *what) {
return status;
}
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))
static void check_isreg(const struct stat *stab, const char *path,
const char *what) {
if (!S_ISREG(stab->st_mode))
@@
-1198,8
+1203,7
@@
typedef void *feedfile_got_article(oop_source *lp, oop_read *rd,
if (r) sysdie("link feedfile %s to flushing file %s", feedfile, dut_path);
/* => Hardlinked */
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 */
/* => Moved */
spawn_inndcomm_flush(); /* => Flushing, sets sms to sm_FLUSHING */
@@
-1545,9
+1549,8
@@
static void statemc_init(void) {
open_defer(); /* so that we will later close it and rename it */
break;
case 2:
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",
break;
default:
die("defer file %s has unexpected link count %d",
@@
-1572,8
+1575,7
@@
static void statemc_init(void) {
if (samefile(&stab_d, &stab_f)) {
debug("startup: F==D => Hardlinked");
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);
found_moved:
debug(" => Moved");
startup_set_input_file(file_d);
@@
-1652,8
+1654,7
@@
static void *statemc_check_input_done(oop_source *lp,
close_defer();
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()) {
if (sms==sm_DROPPING) {
if (search_backlog_file()) {
@@
-1661,8
+1662,7
@@
static void *statemc_check_input_done(oop_source *lp,
return;
}
notice("feed dropped and our work is complete");
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);
}
exit(0);
}