+/* Like savedirstreamp (DIRP), except also close DIRP. */
+
+static char *
+savedirstream (DIR *dirp)
+{
+ char *name_space = streamsavedir (dirp);
+ if (dirp && closedir (dirp) != 0)
+ {
+ int save_errno = errno;
+ free (name_space);
+ errno = save_errno;
+ return NULL;
+ }
+ return name_space;
+}
+