+/* Check if filename occurs in the comma-separated list ignore. */
+static int is_program_ignored(char const *filename, char const *ignore) {
+ size_t length;
+ size_t filename_length = strlen(filename);
+
+#ifdef DEBUG
+ debug(" is_program_ignored(\"%s\", \"%s\")\n", filename, ignore);
+#endif
+
+ for (; *ignore; ignore += length) {
+ while (*ignore == ',') {
+ ignore++;
+ }
+
+ length = strcspn(ignore, ",");
+ if (length == 0) {
+ break;
+ }
+
+ if (length != filename_length) {
+ continue;
+ }
+ if (!strncmp(filename, ignore, length)) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+static int init_tracked_fds_list(size_t count) {
+ assert(count > 0);
+
+ /* Reduce reallocs. */
+ count += TRACKFDS_REALLOC_STEP;
+
+ tracked_fds_list = malloc(count * sizeof(*tracked_fds_list));
+ if (!tracked_fds_list) {
+#ifdef WARNING
+ warning("malloc(tracked_fds_list, %d) failed [%d]\n",
+ count * sizeof(*tracked_fds_list), getpid());
+#endif
+ return 0;
+ }
+
+ tracked_fds_list_space = count;
+ return 1;
+}
+
+/*
+ * Load tracked file descriptors from the environment. The environment is used