mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-30 12:23:06 +02:00
glocalfile: Use MAXSYMLINKS when following symlinks
Currently, readlink() is used only 12 times when expanding symlinks. However, kernel uses 40 for this purpose and it is defined as MAXSYMLINKS. Use that constant if available, or 40. See: https://github.com/torvalds/linux/include/linux/namei.h.
This commit is contained in:
parent
b6191059b8
commit
a56b9cc6b2
@ -1610,7 +1610,15 @@ expand_symlinks (const char *path,
|
||||
}
|
||||
|
||||
num_recursions++;
|
||||
if (num_recursions > 12)
|
||||
|
||||
#ifdef MAXSYMLINKS
|
||||
if (num_recursions > MAXSYMLINKS)
|
||||
#else
|
||||
/* 40 is used in kernel sources currently:
|
||||
* https://github.com/torvalds/linux/include/linux/namei.h
|
||||
*/
|
||||
if (num_recursions > 40)
|
||||
#endif
|
||||
{
|
||||
g_free (target);
|
||||
return NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user