/*
- * xreadlink.c - safe implementation of readlink
+ * xreadlink.c - safe implementation of readlink.
+ * Returns a NULL on failure...
*/
#include <stdio.h>
do {
buf = xrealloc(buf, bufsize += GROWBY);
readsize = readlink(path, buf, bufsize); /* 1st try */
- if (readsize == -1)
- perror_msg("%s:%s", applet_name, path);
+ if (readsize == -1) {
+ perror_msg("%s:%s", applet_name, path);
+ return NULL;
+ }
}
while (bufsize < readsize + 1);