+
+ /* TODO: If we're not root, but the configuration requests
+ * that we change to some uid other than the current one, then
+ * log a warning. */
+
+ /* TODO: Perhaps take a list of gids, and make them into the
+ * supplementary groups. */
+
+ p = lp_include_from(i);
+ add_exclude_file(p, 1, 1);
+
+ p = lp_include(i);
+ add_include_line(p);
+
+ p = lp_exclude_from(i);
+ add_exclude_file(p, 1, 0);
+
+ p = lp_exclude(i);
+ add_exclude_line(p);
+
+ log_init();
+
+ if (use_chroot) {
+ /*
+ * XXX: The 'use chroot' flag is a fairly reliable
+ * source of confusion, because it fails under two
+ * important circumstances: running as non-root,
+ * running on Win32 (or possibly others). On the
+ * other hand, if you are running as root, then it
+ * might be better to always use chroot.
+ *
+ * So, perhaps if we can't chroot we should just issue
+ * a warning, unless a "require chroot" flag is set,
+ * in which case we fail.
+ */
+ if (chroot(lp_path(i))) {
+ rsyserr(FERROR, errno, "chroot %s failed", lp_path(i));
+ io_printf(fd,"@ERROR: chroot failed\n");
+ return -1;
+ }