Skip to main content

Symlink Analyzation Function in C

Here is a simple function for performing symlink analysis using C. The readlink function gets the value of the symbolic link filename. The file name that the link points to is copied into buffer. This file name string is not null-terminated; readlink normally returns the number of characters copied. The size argument specifies the maximum number of characters to copy, usually the allocation size of buffer.

There is significant utility for such a function in a variety of contexts. Have fun with it!


h/t Tanguy