- char *dirname=NULL, *amname=NULL, *filename=NULL;
- int fd;
- unsigned long malloc_hist_1, malloc_size_1;
- unsigned long malloc_hist_2, malloc_size_2;
-
- for(fd = 3; fd < FD_SETSIZE; fd++) {
- /*
- * Make sure nobody spoofs us with a lot of extra open files
- * that would cause an open we do to get a very high file
- * descriptor, which in turn might be used as an index into
- * an array (e.g. an fd_set).
- */
- close(fd);
+ char *dirname=NULL;
+ char *amname=NULL, *qamname=NULL;
+ char *filename=NULL, *qfilename = NULL;
+
+ /* drop root privileges; we'll regain them for the required operations */
+#ifdef WANT_SETUID_CLIENT
+ if (!set_root_privs(0)) {
+ error(_("calcsize must be run setuid root"));