提交 c36e9093 编写于 作者: R Richard Levitte

Better check of return values from app_isdir and app_access

[extended tests]
Reviewed-by: NAndy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6033)
上级 96de2e59
...@@ -676,13 +676,13 @@ int opt_next(void) ...@@ -676,13 +676,13 @@ int opt_next(void)
/* Just a string. */ /* Just a string. */
break; break;
case '/': case '/':
if (app_isdir(arg) >= 0) if (app_isdir(arg) > 0)
break; break;
BIO_printf(bio_err, "%s: Not a directory: %s\n", prog, arg); BIO_printf(bio_err, "%s: Not a directory: %s\n", prog, arg);
return -1; return -1;
case '<': case '<':
/* Input file. */ /* Input file. */
if (strcmp(arg, "-") == 0 || app_access(arg, R_OK) >= 0) if (strcmp(arg, "-") == 0 || app_access(arg, R_OK) == 0)
break; break;
BIO_printf(bio_err, BIO_printf(bio_err,
"%s: Cannot open input file %s, %s\n", "%s: Cannot open input file %s, %s\n",
...@@ -690,7 +690,7 @@ int opt_next(void) ...@@ -690,7 +690,7 @@ int opt_next(void)
return -1; return -1;
case '>': case '>':
/* Output file. */ /* Output file. */
if (strcmp(arg, "-") == 0 || app_access(arg, W_OK) >= 0 || errno == ENOENT) if (strcmp(arg, "-") == 0 || app_access(arg, W_OK) == 0 || errno == ENOENT)
break; break;
BIO_printf(bio_err, BIO_printf(bio_err,
"%s: Cannot open output file %s, %s\n", "%s: Cannot open output file %s, %s\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册