The portable (POSIX.1-specified) thing to do is call lstat and st_size will be the number of bytes that readlink will read.