Skip to content

Commit 486c5d1

Browse files
authored
Merge pull request #1734 from eriksjolund/getcwd-fix-errno
linux: use syscall getcwd return value to set error
2 parents bf72edb + 8c0075b commit 486c5d1

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)