+ add_findex(rx->bsr_list, lst->JobId, lst->FileIndex);
+}
+
+/*
+ * This is a list of all the files (components) that the
+ * user has requested for restore. It is requested by
+ * the plugin (for now hard coded only for VSS).
+ * In the future, this will be requested by a RestoreObject
+ * and the plugin name will be sent to the FD.
+ */
+static bool write_component_file(UAContext *ua, RESTORE_CTX *rx, char *fname)
+{
+ int fd;
+ if (!rx->component_fd) {
+ Mmsg(rx->component_fname, "%s/%s.restore.sel.XXXXXX", working_directory, my_name);
+ fd = mkstemp(rx->component_fname);
+ if (fd < 0) {
+ berrno be;
+ ua->error_msg(_("Unable to create component file %s. ERR=%s\n"),
+ rx->component_fname, be.bstrerror());
+ return false;
+ }
+ rx->component_fd = fdopen(fd, "w+");
+ if (!rx->component_fd) {
+ berrno be;
+ ua->error_msg(_("Unable to fdopen component file %s. ERR=%s\n"),
+ rx->component_fname, be.bstrerror());
+ return false;
+ }
+ }
+ fprintf(rx->component_fd, "%s\n", fname);
+ if (ferror(rx->component_fd)) {
+ ua->error_msg(_("Error writing component file.\n"));
+ fclose(rx->component_fd);
+ unlink(rx->component_fname);
+ rx->component_fd = NULL;
+ return false;
+ }
+ return true;