agent: fix naming for symlinks in CopyFile

The agent referred to the `data` field of an incoming CopyFileRequest
as the 'src'. This is misleading, because 'source' is not mentioned
in the specification (where links are just a path with attached
bytes), and because the documentation for the `ln` utility calls the
path LINK_NAME and the data TARGET. This commit fixes the glitch and
calls the first argument to `symlinkat` the target.

Signed-off-by: Markus Rudy <mr@edgeless.systems>
This commit is contained in:
Markus Rudy
2026-04-15 09:29:24 +02:00
parent 5c362adcff
commit d6bd666b3f

View File

@@ -2191,8 +2191,8 @@ fn do_copy_file(req: &CopyFileRequest) -> Result<()> {
}
// Create new symbolic link
let src = PathBuf::from(OsStr::from_bytes(&req.data));
unistd::symlinkat(&src, None, &path)?;
let symlink_target = PathBuf::from(OsStr::from_bytes(&req.data));
unistd::symlinkat(&symlink_target, None, &path)?;
// Set symlink ownership (permissions not supported for symlinks)
let path_str = CString::new(path.as_os_str().as_bytes())?;