Skip to content

Commit 8c0075b

Browse files
committed
linux: use syscall getcwd return value to set error
Reference: https://github.com/torvalds/linux/blob/df67cb4c58fbb80399a99d47a554a67829f90dda/fs/d_path.c#L394-L411 Signed-off-by: Erik Sjölund <[email protected]>
1 parent b812ced commit 8c0075b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libcrun/linux.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5822,7 +5822,7 @@ libcrun_safe_chdir (const char *path, libcrun_error_t *err)
58225822
buffer = xmalloc (PATH_MAX);
58235823
ret = syscall_getcwd (buffer, PATH_MAX);
58245824
if (UNLIKELY (ret < 0))
5825-
return crun_make_error (err, errno, "getcwd");
5825+
return crun_make_error (err, -ret, "getcwd");
58265826

58275827
/* Enforce that the returned path is an absolute path. */
58285828
if (ret == 0 || buffer[0] != '/')

0 commit comments

Comments
 (0)