Append '/' to directories in source file list (for `-l' option) to allow
quickly distinguish them from regular files (to avoid adding them raw
into %files section). This is needed for ALT for our debuginfo
processing to speed things up.
Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
const char *p = skip_dir_prefix (comp_dir, base_dir);
if (p != NULL && p[0] != '\0')
{
- size_t size = strlen (p) + 1;
+ size_t size = strlen (p);
while (size > 0)
{
ssize_t ret = write (list_file_fd, p, size);
size -= ret;
p += ret;
}
+ /* Output trailing dir separator to distinguish them quickly from
+ regular files. */
+ if (size == 0)
+ {
+ if (*(p - 1) != '/')
+ write (list_file_fd, "/", 2);
+ else
+ write (list_file_fd, "", 1);
+ }
}
}