1
0
Fork 0
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:
Jonas 'Sortie' Termansen 2014-04-29 23:34:12 +02:00
parent 6f35797e19
commit bf9e9d0b25

View file

@ -161,11 +161,13 @@ Node* RecursiveSearch(const char* real_path, const char* virt_path,
if ( lstat(real_path, &st) ) { perror(real_path); return NULL; }
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));
if ( !node ) { return NULL; }
node->nlink = 1;
node->refcount = 1;
node->mode = st.st_mode;
node->ino = (*ino)++;