blob: 6bc9958b907039f4986ed8dbff12be71ea9b6330 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/*
* Copyright 2021 Richard Purdie
*
* SPDX-License-Identifier: GPL-2.0-only
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/*
* Run the original script (argv[0] + ".real") with LD_LIBRARY_PATH unset
* This avoids issues where cargo is running a wrapper script using /bin/sh from the host
* which links to something which has an incompatible version in in recipe-sysroot-native
* such as libtinfo on centos 7.
*/
int main(int argc, char* argv[]) {
char *real = malloc(strlen(argv[0] + 5));
strcpy(real, argv[0]);
strcpy(real + strlen(argv[0]), ".real");
putenv("LD_LIBRARY_PATH=");
if(execv(real, argv) == -1) {
printf("Wrapper failed to execute, error: %s\n", strerror(errno));
return -1;
}
}
|