Multi processing -> multi threading

This commit is contained in:
2022-12-18 22:18:11 +01:00
parent 44913c1e0e
commit 45514f90ca
13 changed files with 464 additions and 515 deletions

View File

@ -9,6 +9,7 @@
#include "uri.h"
#include "utils.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@ -20,12 +21,16 @@ int path_is_directory(const char *path) {
int path_is_file(const char *path) {
struct stat statbuf;
return stat(path, &statbuf) == 0 && S_ISDIR(statbuf.st_mode) == 0;
int ret = stat(path, &statbuf);
errno = 0;
return ret == 0 && S_ISDIR(statbuf.st_mode) == 0;
}
int path_exists(const char *path) {
struct stat statbuf;
return stat(path, &statbuf) == 0;
int ret = stat(path, &statbuf);
errno = 0;
return ret == 0;
}
int uri_init(http_uri *uri, const char *webroot, const char *uri_str, int dir_mode) {