diff --git a/include/bits/errno.h b/include/bits/errno.h
index 15d7d66c417a2a5e548a0c011129a5d5305d71ac..3d6409a2e781f58453b21df1218a2fd7f7bd04b4 100644
--- a/include/bits/errno.h
+++ b/include/bits/errno.h
@@ -8,7 +8,7 @@ extern "C" {
 #define ENOTSUP EOPNOTSUPP
 
 #define errno (*__errno_location())
-#define program_invocation_name (__program_invocation_name())
+#define program_invocation_name (*__program_invocation_name())
 
 #ifdef __cplusplus
 } // extern "C"
diff --git a/src/header/errno/mod.rs b/src/header/errno/mod.rs
index 82dea1c06f3475b50151813282b50fe4a0113b3f..0530f74ee442c3a9850ea9969af4a01c2eec5393 100644
--- a/src/header/errno/mod.rs
+++ b/src/header/errno/mod.rs
@@ -14,8 +14,8 @@ pub unsafe extern "C" fn __errno_location() -> *mut c_int {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn __program_invocation_name() -> *mut c_char {
-    platform::inner_argv[0]
+pub unsafe extern "C" fn __program_invocation_name() -> *mut *mut c_char {
+    &mut platform::inner_argv[0]
 }
 
 pub const EPERM: c_int = 1; /* Operation not permitted */
diff --git a/tests/Makefile b/tests/Makefile
index 4f5e83f67b0f0952e71743948cd46a816a3bf6c8..10692334986d02b04ac7b76e6865569b99b5c43d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -8,6 +8,7 @@ EXPECT_NAMES=\
 	ctype \
 	destructor \
 	dirent/scandir \
+	errno \
 	error \
 	fcntl/create \
 	fcntl/fcntl \
diff --git a/tests/errno.c b/tests/errno.c
new file mode 100644
index 0000000000000000000000000000000000000000..699bfa96a59106da4cd78f3d9e3a27df6872fcca
--- /dev/null
+++ b/tests/errno.c
@@ -0,0 +1,13 @@
+#include <errno.h>
+#include <stdio.h>
+#include "test_helpers.h"
+
+int main(int argc, char **argv) {
+    puts(argv[0]);
+    puts(program_invocation_name);
+
+    program_invocation_name = "yes, you can change this";
+
+    puts(argv[0]);
+    puts(program_invocation_name);
+}
diff --git a/tests/expected/errno.stderr b/tests/expected/errno.stderr
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/tests/expected/errno.stdout b/tests/expected/errno.stdout
new file mode 100644
index 0000000000000000000000000000000000000000..62770a791141177b9744b5c96ba106ac2d39be7e
--- /dev/null
+++ b/tests/expected/errno.stdout
@@ -0,0 +1,4 @@
+bins/errno
+bins/errno
+yes, you can change this
+yes, you can change this