summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2009-10-04 16:43:39 +0000
committerDr. Stephen Henson <steve@openssl.org>2009-10-04 16:43:39 +0000
commitd7050b44243dbe0d1c74c0c1258756f497e8c1a4 (patch)
tree7981e5072421070bc8f27604efd855b00932434c /apps
parent91ca332058992efef6137d22808176b925c7cfc7 (diff)
Fix warnings about ignoring fgets return value
Diffstat (limited to 'apps')
-rw-r--r--apps/ca.c14
-rw-r--r--apps/enc.c7
-rw-r--r--apps/openssl.c3
-rw-r--r--apps/req.c6
4 files changed, 24 insertions, 6 deletions
diff --git a/apps/ca.c b/apps/ca.c
index 7bd229139e..7fc2d57666 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -1249,7 +1249,12 @@ bad:
BIO_printf(bio_err,"\n%d out of %d certificate requests certified, commit? [y/n]",total_done,total);
(void)BIO_flush(bio_err);
buf[0][0]='\0';
- fgets(buf[0],10,stdin);
+ if (!fgets(buf[0],10,stdin))
+ {
+ BIO_printf(bio_err,"CERTIFICATION CANCELED: I/O error\n");
+ ret=0;
+ goto err;
+ }
if ((buf[0][0] != 'y') && (buf[0][0] != 'Y'))
{
BIO_printf(bio_err,"CERTIFICATION CANCELED\n");
@@ -2101,7 +2106,12 @@ again2:
BIO_printf(bio_err,"Sign the certificate? [y/n]:");
(void)BIO_flush(bio_err);
buf[0]='\0';
- fgets(buf,sizeof(buf)-1,stdin);
+ if (!fgets(buf,sizeof(buf)-1,stdin))
+ {
+ BIO_printf(bio_err,"CERTIFICATE WILL NOT BE CERTIFIED: I/O error\n");
+ ok=0;
+ goto err;
+ }
if (!((buf[0] == 'y') || (buf[0] == 'Y')))
{
BIO_printf(bio_err,"CERTIFICATE WILL NOT BE CERTIFIED\n");
diff --git a/apps/enc.c b/apps/enc.c
index f4f9a4c4a4..8f5e5b8935 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -226,7 +226,12 @@ int MAIN(int argc, char **argv)
goto bad;
}
buf[0]='\0';
- fgets(buf,sizeof buf,infile);
+ if (!fgets(buf,sizeof buf,infile))
+ {
+ BIO_printf(bio_err,"unable to read key from '%s'\n",
+ file);
+ goto bad;
+ }
fclose(infile);
i=strlen(buf);
if ((i > 0) &&
diff --git a/apps/openssl.c b/apps/openssl.c
index 7d2b476cf0..8e2d8dd569 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -333,7 +333,8 @@ int main(int Argc, char *Argv[])
else prompt="OpenSSL> ";
fputs(prompt,stdout);
fflush(stdout);
- fgets(p,n,stdin);
+ if (!fgets(p,n,stdin))
+ goto end;
if (p[0] == '\0') goto end;
i=strlen(p);
if (i <= 1) break;
diff --git a/apps/req.c b/apps/req.c
index 5ed08960c1..314197de83 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -1538,7 +1538,8 @@ start:
buf[0]='\0';
if (!batch)
{
- fgets(buf,sizeof buf,stdin);
+ if (!fgets(buf,sizeof buf,stdin))
+ return 0;
}
else
{
@@ -1596,7 +1597,8 @@ start:
buf[0]='\0';
if (!batch)
{
- fgets(buf,sizeof buf,stdin);
+ if (!fgets(buf,sizeof buf,stdin))
+ return 0;
}
else
{