From 1a00319bb9ba29e4445f9642d6cf9a0d169cefb8 Mon Sep 17 00:00:00 2001 From: ewt Date: Wed, 13 Mar 1996 03:51:56 +0000 Subject: [PATCH] - hashing and percentages no longer SIGFPE on 0 byte packages - when an ftp fails, install.c no longer tries to install the package - ftps files to /var/tmp rather then /usr/tmp CVS patchset: 467 CVS date: 1996/03/13 03:51:56 --- install.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/install.c b/install.c index a0a5ff1..2c4029e 100644 --- a/install.c +++ b/install.c @@ -20,7 +20,7 @@ static void printHash(const unsigned long amount, const unsigned long total) { int hashesNeeded; if (hashesPrinted != 50) { - hashesNeeded = 50 * (((float) amount) / total); + hashesNeeded = 50 * (total ? (((float) amount) / total) : 1); while (hashesNeeded > hashesPrinted) { printf("#"); hashesPrinted++; @@ -35,7 +35,9 @@ static void printHash(const unsigned long amount, const unsigned long total) { static void printPercent(const unsigned long amount, const unsigned long total) { - printf("%%%% %f\n", (float) (((float) amount) / total) * 100); + printf("%%%% %f\n", (total + ? ((float) ((((float) amount) / total) * 100)) + : 100.0)); fflush(stdout); } @@ -76,6 +78,7 @@ void doInstall(char * prefix, char * arg, int installFlags, int interfaceFlags) fd = getFtpURL(prefix, arg + 6); if (fd < 0) { fprintf(stderr, "error: cannot ftp %s\n", arg); + return; } } else { fd = open(arg, O_RDONLY); @@ -203,7 +206,7 @@ static int getFtpURL(char * prefix, char * hostAndFile) { *chptr = '/'; tmp = alloca(strlen(prefix) + 60); - sprintf(tmp, "%s/usr/tmp/rpm.ftp.%d", prefix, getuid()); + sprintf(tmp, "%s/var/tmp/rpm.ftp.%d", prefix, getpid()); fd = creat(tmp, 0600); if (fd < 0) { -- 2.7.4