Skip to content

Commit 0e72884

Browse files
committed
fix(stat): replace stat(2) with ocre_lstat)
Various runtimes can use container's workdit with different symbolic links. Using lstat(2) there fixes the rm_rf() and cleans the whole folder properly. Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>
1 parent 1ecf78a commit 0e72884

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/ocre/util/rm_rf.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
#include <string.h>
1111
#include <unistd.h>
1212
#include <dirent.h>
13-
#include <sys/stat.h>
1413
#include <errno.h>
1514

15+
#include <ocre/platform/lstat.h>
16+
1617
/* Stack node for directory traversal */
1718

1819
struct dir_stack_node {
@@ -88,7 +89,7 @@ int rm_rf(const char *path)
8889
}
8990

9091
struct stat st;
91-
if (stat(path, &st) == -1) {
92+
if (ocre_lstat(path, &st) == -1) {
9293
return -1; /* errno already set by stat */
9394
}
9495

@@ -165,7 +166,7 @@ int rm_rf(const char *path)
165166

166167
/* Get entry information */
167168

168-
if (stat(entry_path, &st) == -1) {
169+
if (ocre_lstat(entry_path, &st) == -1) {
169170
result = -1;
170171
free(entry_path);
171172
continue;

0 commit comments

Comments
 (0)