Lines 1034-1059
Link Here
|
1034 |
static void |
1034 |
static void |
1035 |
get_stackprotector(FILE *inFile) |
1035 |
get_stackprotector(FILE *inFile) |
1036 |
{ |
1036 |
{ |
1037 |
FILE *fp; |
|
|
1038 |
char *cc; |
1037 |
char *cc; |
1039 |
char command[1024], buf[1024]; |
1038 |
char command[1024]; |
1040 |
|
1039 |
|
1041 |
cc = getenv("CC"); |
1040 |
cc = getenv("CC"); |
1042 |
if (cc == NULL) { |
1041 |
if (cc == NULL) { |
1043 |
cc = "cc"; |
1042 |
cc = "cc"; |
1044 |
} |
1043 |
} |
1045 |
snprintf(command, sizeof(command), "%s -v 2>&1", cc); |
1044 |
snprintf(command, sizeof(command), "%s -fno-stack-protector -S -o /dev/null -xc /dev/null > /dev/null 2>&1", cc); |
1046 |
fp = popen(command, "r"); |
1045 |
if (system(command)==0) |
1047 |
if (fp == NULL) |
|
|
1048 |
abort(); |
1049 |
while (fgets(buf, sizeof(buf), fp)) { |
1050 |
if (strstr(buf, "propolice") != NULL) { |
1051 |
fprintf(inFile, "#define HasGccStackProtector YES\n"); |
1046 |
fprintf(inFile, "#define HasGccStackProtector YES\n"); |
1052 |
break; |
1047 |
snprintf(command, sizeof(command), "%s -fno-pie -S -o /dev/null -xc /dev/null > /dev/null 2>&1", cc); |
1053 |
} |
1048 |
if (system(command)==0) |
1054 |
} |
1049 |
fprintf(inFile, "#define HasGccPie YES\n"); |
1055 |
if (pclose(fp)) |
|
|
1056 |
abort(); |
1057 |
} |
1050 |
} |
1058 |
|
1051 |
|
1059 |
|
1052 |
|