Browse Source

data: use lstat() instead of stat()

this disallows snac to serve a static file which is a symlink.
lbr 6 months ago
parent
commit
63903b9c46
1 changed files with 1 additions and 1 deletions
  1. 1 1
      data.c

+ 1 - 1
data.c

@@ -2668,7 +2668,7 @@ static int _load_raw_file(const char *fn, xs_val **data, int *size,
                 struct stat sb;
                 FILE *f;
 
-                if (stat(fn, &sb) == 0 && (sb.st_mode&S_IFMT) == S_IFREG) {
+                if (lstat(fn, &sb) == 0 && (sb.st_mode&S_IFMT) == S_IFREG) {
                     if ((f = fopen(fn, "rb")) != NULL) {
                         *size = XS_ALL;
                         *data = xs_read(f, size);