mf: don't limit filename length with PATH_MAX

Use an arbitrary constant instead, which is as good as PATH_MAX.

This helps us to avoid having to think about pull request #523.

Also fix a case where a potentially signed char was passed to isspace().
This commit is contained in:
wm4 2014-02-03 22:09:20 +01:00
parent 48112a74ed
commit 95a72baf92
1 changed files with 3 additions and 3 deletions

View File

@ -64,11 +64,11 @@ mf_t *open_mf_pattern(void *talloc_ctx, struct mp_log *log, char *filename)
if (filename[0] == '@') { if (filename[0] == '@') {
FILE *lst_f = fopen(filename + 1, "r"); FILE *lst_f = fopen(filename + 1, "r");
if (lst_f) { if (lst_f) {
char *fname = talloc_size(mf, MP_PATH_MAX); char *fname = talloc_size(mf, 512);
while (fgets(fname, MP_PATH_MAX, lst_f)) { while (fgets(fname, 512, lst_f)) {
/* remove spaces from end of fname */ /* remove spaces from end of fname */
char *t = fname + strlen(fname) - 1; char *t = fname + strlen(fname) - 1;
while (t > fname && isspace(*t)) while (t > fname && isspace((unsigned char)*t))
*(t--) = 0; *(t--) = 0;
if (!mp_path_exists(fname)) { if (!mp_path_exists(fname)) {
mp_verbose(log, "file not found: '%s'\n", fname); mp_verbose(log, "file not found: '%s'\n", fname);