/*
- * $Id: tools.cc,v 1.254 2005/04/18 21:52:43 hno Exp $
+ * $Id: tools.cc,v 1.255 2005/04/25 18:43:00 serassio Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
{
FILE *pid_fp = NULL;
const char *f = Config.pidFilename;
+ char *chroot_f = NULL;
pid_t pid = -1;
int i;
exit(1);
}
+ if (Config.chroot_dir && geteuid() == 0) {
+ int len = strlen(Config.chroot_dir) + 1 + strlen(f) + 1;
+ chroot_f = (char *)xmalloc(strlen(Config.chroot_dir) + 1 + strlen(f) + 1);
+ snprintf(chroot_f, len, "%s/%s", Config.chroot_dir, f);
+ f = chroot_f;
+ }
+
pid_fp = fopen(f, "r");
if (pid_fp != NULL) {
}
}
+ safe_free(chroot_f);
return pid;
}