[PATCH v4 1/1] ldconfig: add --install option
DJ Delorie
dj@redhat.com
Wed Jun 17 20:58:30 GMT 2026
Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> writes:
>> + /* This matches the temp file created by cache.c, and should be
>> + on the same filesystem as the cache file. */
>> + sprintf(dest, "%s~", cache_file);
>
> I tend to avoid sprintf, and we do have xasprintf:
I had changed this to strcpy/stpcpy, but then I noticed that sprintf
(and asprintf) is used extensively through ldconfig.c, and strcpy not at
all. So I left it for consistency.
>> + /* Now write that first part out. */
>> + dest_fd = open (dest, O_WRONLY, 0644);
>
> I think it requires O_CREAT, and the elf/cache.c:682 uses:
>
> int fd = open (temp_name, O_CREAT|O_WRONLY|O_TRUNC|O_NOFOLLOW, S_IRUSR|S_IWUSR);
Fixed.
More information about the Libc-alpha
mailing list