- 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
This commit is contained in:
ewt 1996-03-13 03:51:56 +00:00
parent 9d5800fe34
commit 1a00319bb9
1 changed files with 6 additions and 3 deletions

View File

@ -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) {