2 * xreadlink.c - safe implementation of readlink
8 * NOTE: This function returns a malloced char* that you will have to free
9 * yourself. You have been warned.
15 extern char *xreadlink(const char *path)
17 static const int GROWBY = 80; /* how large we will grow strings by */
20 int bufsize = 0, readsize = 0;
23 buf = xrealloc(buf, bufsize += GROWBY);
24 readsize = readlink(path, buf, bufsize); /* 1st try */
26 perror_msg("%s:%s", applet_name, path);
28 while (bufsize < readsize + 1);