r300g: Use PATH_MAX instead of limiting ourselves to 100 chars.
When built with Gentoo's package manager, the Mesa source directory exists seven directories deep. The path to the .test file is too long and is silently truncated, leading to a crash. Just use PATH_MAX. Cc: 10.4, 10.5 <mesa-stable@lists.freedesktop.org> Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=540970 Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
This commit is contained in:
parent
67e0a4f6e8
commit
f5e2aa1324
|
@ -28,6 +28,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -528,7 +529,6 @@ void init_compiler(
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_LINE_LENGTH 100
|
#define MAX_LINE_LENGTH 100
|
||||||
#define MAX_PATH_LENGTH 100
|
|
||||||
|
|
||||||
unsigned load_program(
|
unsigned load_program(
|
||||||
struct radeon_compiler *c,
|
struct radeon_compiler *c,
|
||||||
|
@ -536,14 +536,14 @@ unsigned load_program(
|
||||||
const char *filename)
|
const char *filename)
|
||||||
{
|
{
|
||||||
char line[MAX_LINE_LENGTH];
|
char line[MAX_LINE_LENGTH];
|
||||||
char path[MAX_PATH_LENGTH];
|
char path[PATH_MAX];
|
||||||
FILE *file;
|
FILE *file;
|
||||||
unsigned *count;
|
unsigned *count;
|
||||||
char **string_store;
|
char **string_store;
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
|
|
||||||
memset(line, 0, sizeof(line));
|
memset(line, 0, sizeof(line));
|
||||||
snprintf(path, MAX_PATH_LENGTH, TEST_PATH "/%s", filename);
|
snprintf(path, PATH_MAX, TEST_PATH "/%s", filename);
|
||||||
file = fopen(path, "r");
|
file = fopen(path, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue