]> git.ipfire.org Git - thirdparty/glibc.git/commit
stdlib: Simplify buffer management in canonicalize
authorFlorian Weimer <fweimer@redhat.com>
Tue, 5 Jul 2022 09:04:45 +0000 (11:04 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 20 Jan 2025 14:19:48 +0000 (15:19 +0100)
commit525e5f13de043a1eae59e2184afeed2d72c6de48
treee3b08d24e79ad05370a2cb7cc78fe12cc084769e
parent5eae2754008650e411fa9d2ddc731dcd62983c75
stdlib: Simplify buffer management in canonicalize

Move the buffer management from realpath_stk to __realpath.  This
allows returning directly after allocation errors.

Always make a copy of the result buffer using strdup even if it is
already heap-allocated.  (Heap-allocated buffers are somewhat rare.)
This avoids GCC warnings at certain optimization levels.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
(cherry picked from commit ef0700004bf0dccf493a5e8e21f71d9e7972ea9f)
stdlib/canonicalize.c