Negative r has a meaning in the cached file logic, so be sure to reset it to -1
after sc_print_path has returned a value. git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2819 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
b07df40932
commit
723888d623
|
@ -123,7 +123,7 @@ int sc_pkcs15_read_cached_file(struct sc_pkcs15_card *p15card,
|
||||||
*bufsize = count;
|
*bufsize = count;
|
||||||
if (data)
|
if (data)
|
||||||
*buf = data;
|
*buf = data;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sc_pkcs15_cache_file(struct sc_pkcs15_card *p15card,
|
int sc_pkcs15_cache_file(struct sc_pkcs15_card *p15card,
|
||||||
|
|
|
@ -1519,7 +1519,7 @@ int sc_pkcs15_read_file(struct sc_pkcs15_card *p15card,
|
||||||
sc_path_t tmp_path, *path = &tmp_path;
|
sc_path_t tmp_path, *path = &tmp_path;
|
||||||
u8 *data = NULL;
|
u8 *data = NULL;
|
||||||
size_t len = 0, offset = 0;
|
size_t len = 0, offset = 0;
|
||||||
int r = -1;
|
int r;
|
||||||
|
|
||||||
assert(p15card != NULL && in_path != NULL && buf != NULL);
|
assert(p15card != NULL && in_path != NULL && buf != NULL);
|
||||||
|
|
||||||
|
@ -1543,7 +1543,7 @@ int sc_pkcs15_read_file(struct sc_pkcs15_card *p15card,
|
||||||
} else {
|
} else {
|
||||||
memcpy(path, in_path, sizeof(sc_path_t));
|
memcpy(path, in_path, sizeof(sc_path_t));
|
||||||
}
|
}
|
||||||
|
r = -1; /* file state: not in cache */
|
||||||
if (p15card->opts.use_cache) {
|
if (p15card->opts.use_cache) {
|
||||||
r = sc_pkcs15_read_cached_file(p15card, path, &data, &len);
|
r = sc_pkcs15_read_cached_file(p15card, path, &data, &len);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue