summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2009-10-04 16:43:21 +0000
committerDr. Stephen Henson <steve@openssl.org>2009-10-04 16:43:21 +0000
commit2280f82fc6718b8cc07775f7083c0dd663c3ff47 (patch)
tree83dfb457eace074172e10048c3e5fc33591f590a /apps
parente6714faffbdfc551ab8b2a50954519dff4bc7b15 (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 007b501d00..e92ad57d92 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -1263,7 +1263,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");
@@ -2122,7 +2127,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 53de51ad72..3c2c91e920 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -243,7 +243,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 c9d9fe9288..851e639735 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -330,7 +330,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 b97a9f187b..65cb19b4ee 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -1441,7 +1441,8 @@ start:
buf[0]='\0';
if (!batch)
{
- fgets(buf,sizeof buf,stdin);
+ if (!fgets(buf,sizeof buf,stdin))
+ return 0;
}
else
{
@@ -1499,7 +1500,8 @@ start:
buf[0]='\0';
if (!batch)
{
- fgets(buf,sizeof buf,stdin);
+ if (!fgets(buf,sizeof buf,stdin))
+ return 0;
}
else
{