summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/util.c b/util.c
index 0ac1f7a..715396c 100644
--- a/util.c
+++ b/util.c
@@ -59,10 +59,15 @@ int xreaddir(DIR *dir, struct dirent **de) {
}
char *xreadlinkat(int fd, const char *path, size_t size) {
- ++size; // NUL-terminator
ssize_t len;
char *name = NULL;
+ if (size == 0) {
+ size = 64;
+ } else {
+ ++size; // NUL terminator
+ }
+
while (true) {
char *new_name = realloc(name, size);
if (!new_name) {