Skip to content
Snippets Groups Projects
Commit 4859c222 authored by Steve McKay's avatar Steve McKay
Browse files

Make program_invocation_name modifiable

libiconv expects program_invocation_name to be an lvalue
parent 4f2a93ea
No related branches found
No related tags found
No related merge requests found
......@@ -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"
......
......@@ -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 */
......
......@@ -8,6 +8,7 @@ EXPECT_NAMES=\
ctype \
destructor \
dirent/scandir \
errno \
error \
fcntl/create \
fcntl/fcntl \
......
#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);
}
bins/errno
bins/errno
yes, you can change this
yes, you can change this
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment