mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix mkinitrd not maintaining correct hard link count.
This commit is contained in:
parent
6f35797e19
commit
bf9e9d0b25
1 changed files with 3 additions and 1 deletions
|
@ -161,11 +161,13 @@ Node* RecursiveSearch(const char* real_path, const char* virt_path,
|
||||||
if ( lstat(real_path, &st) ) { perror(real_path); return NULL; }
|
if ( lstat(real_path, &st) ) { perror(real_path); return NULL; }
|
||||||
|
|
||||||
Node* cached = LookupCache(st.st_dev, st.st_ino);
|
Node* cached = LookupCache(st.st_dev, st.st_ino);
|
||||||
if ( cached ) { cached->refcount++; return cached; }
|
if ( cached )
|
||||||
|
return cached->nlink++, cached->refcount++, cached;
|
||||||
|
|
||||||
Node* node = (Node*) calloc(1, sizeof(Node));
|
Node* node = (Node*) calloc(1, sizeof(Node));
|
||||||
if ( !node ) { return NULL; }
|
if ( !node ) { return NULL; }
|
||||||
|
|
||||||
|
node->nlink = 1;
|
||||||
node->refcount = 1;
|
node->refcount = 1;
|
||||||
node->mode = st.st_mode;
|
node->mode = st.st_mode;
|
||||||
node->ino = (*ino)++;
|
node->ino = (*ino)++;
|
||||||
|
|
Loading…
Add table
Reference in a new issue