+#include <alloca.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
static void printHash(const unsigned long amount, const unsigned long total);
static void printPercent(const unsigned long amount, const unsigned long total);
-static int getFtpURL(char * hostAndFile);
+static int getFtpURL(char * prefix, char * hostAndFile);
static void printHash(const unsigned long amount, const unsigned long total) {
int hashesNeeded;
if (isVerbose()) {
printf("Retrieving %s\n", arg);
}
- fd = getFtpURL(arg + 6);
+ fd = getFtpURL(prefix, arg + 6);
if (fd < 0) {
fprintf(stderr, "error: cannot ftp %s\n", arg);
}
return rc;
}
-static int getFtpURL(char * hostAndFile) {
+static int getFtpURL(char * prefix, char * hostAndFile) {
char * buf;
char * chptr;
int ftpconn;
*chptr = '/';
- tmp = tmpnam(NULL);
+ tmp = alloca(strlen(prefix) + 60);
+ sprintf(tmp, "%s/usr/tmp/rpm.ftp.%d", prefix, getuid());
fd = creat(tmp, 0600);
if (fd < 0) {