Solar Designer wrote: > > Hi, > > This sounds like a bug to me. Noticed it last year and I've just > checked that it's still not resolved in the latest snapshot. > > jill!solar:~/build/openssl-SNAP-20020416$ apps/openssl dgst -md5 /bin/ls > MD5(/bin/ls)= d93498d9f52c3dc0330ab930fe3ffc50 > > OK. > > jill!solar:~/build/openssl-SNAP-20020416$ apps/openssl dgst -md5 /bin > MD5(/bin)= d41d8cd98f00b204e9800998ecf8427e > jill!solar:~/build/openssl-SNAP-20020416$ apps/openssl dgst -md5 /dev/log > MD5(/dev/log)= d41d8cd98f00b204e9800998ecf8427e > > Wrong. I'd want it to fail with a message to stderr and a non-zero > exit code. Also on any read error, not just on non-regular files. > > open("/bin", O_RDONLY) = 4 > [some getpid()'s] > read(4, 0x8189fb0, 8192) = -1 EISDIR (Is a directory) > [lots of getpid()'s, why?!] > write(1, "MD5(/bin)= d41d8cd98f00b204e9800"..., 44) = 44
Try this for size (against 0.9.7, but probably will work on other versions).... Index: crypto/bio/bss_file.c =================================================================== RCS file: /e/openssl/cvs/openssl/crypto/bio/bss_file.c,v retrieving revision 1.14 diff -u -r1.14 bss_file.c --- crypto/bio/bss_file.c 2002/01/24 16:15:00 1.14 +++ crypto/bio/bss_file.c 2002/04/23 11:06:15 @@ -162,6 +162,8 @@ if (b->init && (out != NULL)) { ret=fread(out,1,(int)outl,(FILE *)b->ptr); + if(ret == 0 && ferror((FILE *)b->ptr)) + ret=-1; } return(ret); } Index: apps/dgst.c =================================================================== RCS file: /e/openssl/cvs/openssl/apps/dgst.c,v retrieving revision 1.23.2.2 diff -u -r1.23.2.2 dgst.c --- apps/dgst.c 2002/04/06 18:59:57 1.23.2.2 +++ apps/dgst.c 2002/04/23 11:06:14 @@ -362,7 +362,13 @@ for (;;) { i=BIO_read(bp,(char *)buf,BUFSIZE); - if (i <= 0) break; + if(i < 0) + { + BIO_printf(bio_err, "Read Error\n"); + ERR_print_errors(bio_err); + return; + } + if (i == 0) break; } if(sigin) { Cheers, Ben. -- http://www.apache-ssl.org/ben.html http://www.thebunker.net/ "There is no limit to what a man can do or how far he can go if he doesn't mind who gets the credit." - Robert Woodruff ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]