File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,13 @@ int main () {
1919#include <pkcs11-helper-1.0/pkcs11h-certificate.h>
2020#include <unistd.h>
2121
22+ static
23+ void
24+ fatal0 (const char * const m ) {
25+ fprintf (stderr , "%sn" , m );
26+ exit (1 );
27+ }
28+
2229static
2330void
2431fatal (const char * const m , CK_RV rv ) {
@@ -33,7 +40,9 @@ mypause (const char * const m) {
3340
3441 fprintf (stdout , "%s" , m );
3542 fflush (stdout );
36- fgets (temp , sizeof (temp ), stdin );
43+ if (fgets (temp , sizeof (temp ), stdin ) == NULL ) {
44+ fatal0 ("fgets failed" );
45+ }
3746}
3847
3948static
@@ -63,7 +72,9 @@ _pkcs11h_hooks_token_prompt (
6372
6473 while (!fValidInput ) {
6574 fprintf (stderr , "Please insert token '%s' 'ok' or 'cancel': " , token -> display );
66- fgets (buf , sizeof (buf ), stdin );
75+ if (fgets (buf , sizeof (buf ), stdin ) == NULL ) {
76+ fatal0 ("fgets failed" );
77+ }
6778 buf [sizeof (buf )- 1 ] = '\0' ;
6879 fflush (stdin );
6980
You can’t perform that action at this time.
0 commit comments