#define BLOCKSIZE 1024
+/* -1 fileCount means install all files */
static int installArchive(char * prefix, int fd, struct fileToInstall * files,
int fileCount, notifyFunction notify,
char ** specFile, char * tmpPath, int archiveSize) {
int len;
int childDead = 0;
+ /* no files to install */
if (!fileCount) return 0;
+ /* install all files, so don't pass a filelist to cpio */
+ if (fileCount == -1) fileCount = 0;
+
/* fd should be a gzipped cpio archive */
message(MESS_DEBUG, "installing archive into %s\n", prefix);
fflush(stdout);
}
- if (installArchive(realSourceDir, fd, NULL, 0, notify, &specFile,
+ if (installArchive(realSourceDir, fd, NULL, -1, notify, &specFile,
tmpPath, archiveSizePtr ? *archiveSizePtr : 0)) {
return 1;
}
int source, dest, i;
char buf[16384];
+ message(MESS_DEBUG, "coping %s to %s\n", sourceName, destName);
+
source = open(sourceName, O_RDONLY);
if (source < 0) {
error(RPMERR_INTERNAL, "file %s missing from source directory",
}
while ((i = read(source, buf, sizeof(buf))) > 0) {
- if (write(source, buf, i) != i) {
+ if (write(dest, buf, i) != i) {
if (errno == ENOSPC) {
error(RPMERR_NOSPACE, "out of disk space writing file %s",
destName);
} else {
- error(RPMERR_CREATE, "error writing to writing file %s: %s",
+ error(RPMERR_CREATE, "error writing to file %s: %s",
destName, strerror(errno));
}
close(source);