Skip to content

Commit

Permalink
lcfs_build: Read symlink data into payload.
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Larsson <[email protected]>
  • Loading branch information
alexlarsson committed Sep 22, 2023
1 parent a3396f5 commit 37e8673
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions libcomposefs/lcfs-writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,17 @@ struct lcfs_node_s *lcfs_load_node_from_file(int dirfd, const char *fname,
return NULL;
}
}
} else if ((sb.st_mode & S_IFMT) == S_IFLNK) {
char target[PATH_MAX + 1];

r = readlinkat(dirfd, fname, target, sizeof(target));
if (r < 0)
return NULL;

target[r] = '\0';
r = lcfs_node_set_payload(ret, target);
if (r < 0)
return NULL;
}

if ((buildflags & LCFS_BUILD_USE_EPOCH) == 0) {
Expand Down

0 comments on commit 37e8673

Please sign in to comment.