Fix division-by-zero error

This commit is contained in:
Damien Miller 1999-11-12 16:28:02 +11:00
parent 7df20e2ffc
commit 9c8da3ce32
2 changed files with 6 additions and 4 deletions

View File

@ -21,6 +21,8 @@
- [mpaux.c] clear temp buffer - [mpaux.c] clear temp buffer
- [servconf.c] print _all_ bad options found in configfile - [servconf.c] print _all_ bad options found in configfile
- Make ssh-askpass support optional through autoconf - Make ssh-askpass support optional through autoconf
- Fix nasty division-by-zero error in scp.c
- Released 1.2pre11
19991111 19991111
- Added (untested) Entropy Gathering Daemon (EGD) support - Added (untested) Entropy Gathering Daemon (EGD) support

8
scp.c
View File

@ -42,11 +42,11 @@ and ssh has the necessary privileges.)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: scp.c,v 1.4 1999/11/11 10:39:50 damien Exp $ * $Id: scp.c,v 1.5 1999/11/12 05:28:02 damien Exp $
*/ */
#include "includes.h" #include "includes.h"
RCSID("$Id: scp.c,v 1.4 1999/11/11 10:39:50 damien Exp $"); RCSID("$Id: scp.c,v 1.5 1999/11/12 05:28:02 damien Exp $");
#include "ssh.h" #include "ssh.h"
#include "xmalloc.h" #include "xmalloc.h"
@ -976,7 +976,7 @@ run_err(const char *fmt, ...)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: scp.c,v 1.4 1999/11/11 10:39:50 damien Exp $ * $Id: scp.c,v 1.5 1999/11/12 05:28:02 damien Exp $
*/ */
char * char *
@ -1131,7 +1131,7 @@ progressmeter(int flag)
} }
(void)gettimeofday(&now, (struct timezone *)0); (void)gettimeofday(&now, (struct timezone *)0);
cursize = statbytes; cursize = statbytes;
if (totalbytes != 0) { if ((totalbytes >> 10) != 0) {
ratio = (cursize >> 10) * 100 / (totalbytes >> 10); ratio = (cursize >> 10) * 100 / (totalbytes >> 10);
ratio = MAX(ratio, 0); ratio = MAX(ratio, 0);
ratio = MIN(ratio, 100); ratio = MIN(ratio, 100);