+static void warn_via_fd(int e, const char *fmt, va_list ap)
+{
+ char *p = failpath_string();
+
+ vdprintf(warnfd, fmt, ap);
+ if (e != -1)
+ dprintf(warnfd, ": %s", strerror(e));
+ dprintf(warnfd, " [%s]\n", p);
+ free(p);
+}
+
+static void fwarn(const char *fmt, ...)
+{
+ va_list ap;
+ int e = errno;
+
+ va_start(ap, fmt);
+ warn_via_fd(e, fmt, ap);
+ va_end(ap);
+}
+
+
+static void fwarnx(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ warn_via_fd(-1, fmt, ap);
+ va_end(ap);
+}
+