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
1 changed files with 3 additions and 1 deletions

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)++;