minor formatting changes for PR #114

This commit is contained in:
Fufu Fang 2023-07-26 07:45:41 +08:00
parent 282605b0ac
commit 6d8db94458
2 changed files with 12 additions and 10 deletions

View File

@ -44,7 +44,7 @@ static int fs_getattr(const char *path, struct stat *stbuf)
if (!link) { if (!link) {
return -ENOENT; return -ENOENT;
} }
struct timespec spec = {0}; struct timespec spec = { 0 };
spec.tv_sec = link->time; spec.tv_sec = link->time;
#if defined(__APPLE__) && defined(__MACH__) #if defined(__APPLE__) && defined(__MACH__)
stbuf->st_mtimespec = spec; stbuf->st_mtimespec = spec;

View File

@ -742,17 +742,17 @@ LinkTable *LinkTable_disk_open(const char *dirn)
LinkTable *path_to_Link_LinkTable_new(const char *path) LinkTable *path_to_Link_LinkTable_new(const char *path)
{ {
struct Link *link = NULL, *tmp_link = NULL; Link *link = NULL;
struct Link linkcpy = {0}; Link *tmp_link = NULL;
Link link_cpy = { 0 };
LinkTable *next_table = NULL; LinkTable *next_table = NULL;
if (!strcmp(path, "/")) { if (!strcmp(path, "/")) {
next_table = ROOT_LINK_TBL; next_table = ROOT_LINK_TBL;
linkcpy = *next_table->links[0]; link_cpy = *next_table->links[0];
tmp_link = &linkcpy; tmp_link = &link_cpy;
} else { } else {
link = path_to_Link(path); link = path_to_Link(path);
tmp_link = link; tmp_link = link;
LinkTable *next_table = link->next_table;
} }
if (next_table) if (next_table)
@ -760,11 +760,12 @@ LinkTable *path_to_Link_LinkTable_new(const char *path)
time_t time_now = time(NULL); time_t time_now = time(NULL);
if (time_now - next_table->index_time > CONFIG.refresh_timeout) if (time_now - next_table->index_time > CONFIG.refresh_timeout)
{ {
// refresh directory contents /* refresh directory contents */
LinkTable_free(next_table); LinkTable_free(next_table);
next_table = NULL; next_table = NULL;
if (link) if (link) {
link->next_table = NULL; link->next_table = NULL;
}
} }
} }
if (!next_table) { if (!next_table) {
@ -782,10 +783,11 @@ LinkTable *path_to_Link_LinkTable_new(const char *path)
lprintf(fatal, "Invalid CONFIG.mode\n"); lprintf(fatal, "Invalid CONFIG.mode\n");
} }
} }
if (link) if (link) {
link->next_table = next_table; link->next_table = next_table;
else } else {
ROOT_LINK_TBL = next_table; ROOT_LINK_TBL = next_table;
}
return next_table; return next_table;
} }