From 6998d850c067a18eac3130f534309089f5e3da76 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 3 Oct 2023 21:34:37 +0200 Subject: Fix build --- fs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'fs.c') diff --git a/fs.c b/fs.c index acfbc172d..744f1674b 100644 --- a/fs.c +++ b/fs.c @@ -135,7 +135,7 @@ filter_node_name (char* name) /* Returns either NULL or a pointer to a node if found. */ static inline struct node* -_find_node (struct node *dir, char *name) +_find_node (struct node *dir, const char *name) { struct node *node = NULL; @@ -176,7 +176,7 @@ _find_node (struct node *dir, char *name) } struct node * -fs_find_node (struct node *dir, char *name) +fs_find_node (struct node *dir, const char *name) { return _find_node (dir, name); } @@ -461,9 +461,10 @@ fs_get_path_from_root (struct node *root, struct node *node) if (strlen (path) + strlen (n->nn->name) + 1 + 1 > len) { char* new; + size_t offset = ptr - path; len *= 2; new = realloc (path, len); - ptr = new + (ptr - path); + ptr = new + offset; path = new; } REVERSE_COPY (ptr, n->nn->name); @@ -507,9 +508,10 @@ fs_get_path_to_root (struct node *root, struct node *node) if (strlen (path) + 3 + 1 > len) { char* new; + size_t offset = ptr - path; len *= 2; new = realloc (path, len); - ptr = new + (ptr - path); + ptr = new + offset; path = new; } strncpy (ptr, "../", 3); -- cgit v1.2.3