From: Sven Verdoolaege Date: Tue, 22 Apr 2014 08:16:14 +0000 (+0200) Subject: iscc: also disallow source operation when --no-io is specified X-Git-Tag: barvinok-0.38~59 X-Git-Url: https://repo.or.cz/w/barvinok.git/commitdiff_plain/24588fa3d916b150f8a44d67e6d3cf8da0686409 iscc: also disallow source operation when --no-io is specified When this option was introduced in 28ec50b (iscc: optionally disable read operation, Sun Jan 16 10:16:04 2011 +0100), it appears we missed the fact that the source operation can also be used to read files. Signed-off-by: Sven Verdoolaege --- diff --git a/iscc.c b/iscc.c index 52ed315..6d1a91e 100644 --- a/iscc.c +++ b/iscc.c @@ -2528,6 +2528,7 @@ static __isl_give isl_printer *source_file(struct isl_stream *s, { struct isl_token *tok; struct isl_stream *s_file; + struct iscc_options *options; char *name; FILE *file; @@ -2538,6 +2539,15 @@ static __isl_give isl_printer *source_file(struct isl_stream *s, return p; } + isl_stream_eat(s, ';'); + + options = isl_ctx_peek_iscc_options(s->ctx); + if (!options || !options->io) { + isl_token_free(tok); + isl_die(s->ctx, isl_error_invalid, + "source operation not allowed", return p); + } + name = isl_token_get_str(s->ctx, tok); isl_token_free(tok); file = fopen(name, "r"); @@ -2558,8 +2568,6 @@ static __isl_give isl_printer *source_file(struct isl_stream *s, isl_stream_free(s_file); fclose(file); - isl_stream_eat(s, ';'); - return p; }