Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cf-agent/simulate_mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,16 @@ static JsonElement *ChangedFileAsJson(const char *path)
/* The permissions of a symbolic link are meaningless. */
if (S_ISLNK(st.st_mode))
{
char target[PATH_MAX] = {0};
if (readlink(chrooted_path, target, sizeof(target) - 1) > 0)
{
const char *real_target = target;
if (IsAbsoluteFileName(target))
{
real_target = ToNormalRoot(target);
}
JsonObjectAppendString(file_info, "target", real_target);
}
return file_info;
}
#endif /* !__MINGW32__ */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"change": "created",
"gid": GID,
"path": "WORKDIR/tmp/link",
"target": "WORKDIR/tmp/modify-me",
"type": "symbolic link",
"uid": UID
}
Expand Down