Commit 2bbc28fb authored by Bernhard Link's avatar Bernhard Link

avoid warnings generated by -Wshadow

parent 22f12810
......@@ -328,13 +328,13 @@ inline static retvalue aptmethod_startup(struct aptmethod *method) {
(void)close(mstdin[1]);
(void)close(mstdout[0]);
if( dup2(mstdin[0],0) < 0 ) {
int e = errno;
e = errno;
fprintf(stderr, "Error %d while setting stdin: %s\n",
e, strerror(e));
exit(255);
}
if( dup2(mstdout[1],1) < 0 ) {
int e = errno;
e = errno;
fprintf(stderr, "Error %d while setting stdout: %s\n",
e, strerror(e));
exit(255);
......
......@@ -20,7 +20,7 @@ if [ "x$1" = "x--configure" ] ; then
cd "$1" || exit 1
shift
fi
"$repreprodir"/configure --enable-maintainer-mode CFLAGS="-Wall -O2 -g -Wmissing-prototypes -Wstrict-prototypes -DSTUPIDCC=1" "$@"
"$repreprodir"/configure --enable-maintainer-mode CFLAGS="-Wall -O2 -g -Wmissing-prototypes -Wstrict-prototypes -Wshadow -DSTUPIDCC=1" "$@"
else
echo "unsupported option $1" >&2
exit 1
......
......@@ -75,7 +75,7 @@ static retvalue binaries_parse_checksums(const char *chunk, /*@out@*/struct chec
}
/* get somefields out of a "Packages.gz"-chunk. returns RET_OK on success, RET_NOTHING if incomplete, error otherwise */
static retvalue binaries_parse_chunk(const char *chunk, const char *packagename, const char *packagetype, const char *version, /*@out@*/char **sourcename, /*@out@*/char **basename, /*@out@*/enum filetype *ft_p) {
static retvalue binaries_parse_chunk(const char *chunk, const char *packagename, const char *packagetype, const char *version, /*@out@*/char **sourcename_p, /*@out@*/char **basename_p, /*@out@*/enum filetype *ft_p) {
retvalue r;
char *parch;
char *mysourcename,*mybasename;
......@@ -119,8 +119,8 @@ static retvalue binaries_parse_chunk(const char *chunk, const char *packagename,
return RET_ERROR_OOM;
}
*basename = mybasename;
*sourcename = mysourcename;
*basename_p = mybasename;
*sourcename_p = mysourcename;
return RET_OK;
}
......@@ -143,7 +143,7 @@ retvalue binaries_getfilekeys(const char *chunk, struct strlist *files) {
return r;
}
static retvalue calcfilekeys(const char *component,const char *sourcename,const char *basename,struct strlist *filekeys) {
static retvalue calcfilekeys(const char *component, const char *sourcename, const char *basefilename, struct strlist *filekeys) {
char *filekey;
retvalue r;
......@@ -151,17 +151,17 @@ static retvalue calcfilekeys(const char *component,const char *sourcename,const
if( RET_WAS_ERROR(r) ) {
return r;
}
filekey = calc_filekey(component,sourcename,basename);
filekey = calc_filekey(component, sourcename, basefilename);
if( filekey == NULL )
return RET_ERROR_OOM;
r = strlist_init_singleton(filekey,filekeys);
return r;
}
static inline retvalue calcnewcontrol(const char *chunk,const char *sourcename,const char *basename,const char *component,struct strlist *filekeys,char **newchunk) {
static inline retvalue calcnewcontrol(const char *chunk, const char *sourcename, const char *basefilename, const char *component, struct strlist *filekeys, char **newchunk) {
retvalue r;
r = calcfilekeys(component,sourcename,basename,filekeys);
r = calcfilekeys(component, sourcename, basefilename, filekeys);
if( RET_WAS_ERROR(r) )
return r;
......@@ -188,13 +188,13 @@ retvalue binaries_getversion(const char *control, char **version) {
}
retvalue binaries_getinstalldata(const struct target *t, const char *packagename, const char *version, const char *chunk, char **control, struct strlist *filekeys, struct checksumsarray *origfiles, /*@null@*//*@out@*/enum filetype *type_p) {
char *sourcename IFSTUPIDCC(=NULL) ,*basename IFSTUPIDCC(=NULL);
char *sourcename IFSTUPIDCC(=NULL), *basefilename IFSTUPIDCC(=NULL);
struct checksumsarray origfilekeys;
retvalue r;
enum filetype ft IFSTUPIDCC(='?');
r = binaries_parse_chunk(chunk, packagename, t->packagetype,
version, &sourcename, &basename, &ft);
version, &sourcename, &basefilename, &ft);
if( RET_WAS_ERROR(r) ) {
return r;
} else if( r == RET_NOTHING ) {
......@@ -203,11 +203,11 @@ retvalue binaries_getinstalldata(const struct target *t, const char *packagename
}
r = binaries_getchecksums(chunk, &origfilekeys);
if( RET_WAS_ERROR(r) ) {
free(sourcename);free(basename);
free(sourcename); free(basefilename);
return r;
}
r = calcnewcontrol(chunk, sourcename, basename,
r = calcnewcontrol(chunk, sourcename, basefilename,
t->component, filekeys, control);
if( RET_WAS_ERROR(r) ) {
checksumsarray_done(&origfilekeys);
......@@ -217,7 +217,7 @@ retvalue binaries_getinstalldata(const struct target *t, const char *packagename
}
if( type_p != NULL )
*type_p = ft;
free(sourcename);free(basename);
free(sourcename); free(basefilename);
return r;
}
......@@ -695,15 +695,15 @@ retvalue binaries_checkadddeb(const struct deb_headers *deb, struct database *da
retvalue binaries_calcfilekeys(const char *component,const struct deb_headers *deb,const char *packagetype,struct strlist *filekeys) {
retvalue r;
char *basename;
char *basefilename;
basename = calc_binary_basename(deb->name, deb->version,
basefilename = calc_binary_basename(deb->name, deb->version,
deb->architecture, packagetype);
if( basename == NULL )
if( FAILEDTOALLOC(basefilename) )
return RET_ERROR_OOM;
r = calcfilekeys(component, deb->source, basename, filekeys);
free(basename);
r = calcfilekeys(component, deb->source, basefilename, filekeys);
free(basefilename);
return r;
}
......@@ -38,7 +38,7 @@ retvalue changes_parsefileline(const char *fileline, /*@out@*/filetype *result_t
const char *archstart,*archend;
const char *versionstart,*typestart;
filetype type;
char *section, *priority, *basename, *architecture, *name;
char *section, *priority, *basefilename, *architecture, *name;
p = fileline;
while( *p !='\0' && xisspace(*p) )
......@@ -190,15 +190,16 @@ retvalue changes_parsefileline(const char *fileline, /*@out@*/filetype *result_t
archstart = "source";
archend = archstart + 6;
}
section = strndup(sectionstart,sectionend-sectionstart);
priority = strndup(priostart,prioend-priostart);
basename = strndup(filestart,fileend-filestart);
architecture = strndup(archstart,archend-archstart);
name = strndup(filestart,nameend-filestart);
if( section == NULL || priority == NULL ||
basename == NULL || architecture == NULL || name == NULL ) {
section = strndup(sectionstart, sectionend - sectionstart);
priority = strndup(priostart, prioend - priostart);
basefilename = strndup(filestart, fileend - filestart);
architecture = strndup(archstart, archend - archstart);
name = strndup(filestart, nameend - filestart);
if( FAILEDTOALLOC(section) || FAILEDTOALLOC(priority) ||
FAILEDTOALLOC(basefilename) || FAILEDTOALLOC(architecture) ||
FAILEDTOALLOC(name) ) {
free(section); free(priority);
free(basename); free(architecture); free(name);
free(basefilename); free(architecture); free(name);
return RET_ERROR_OOM;
}
hash_p->start = md5start;
......@@ -207,7 +208,7 @@ retvalue changes_parsefileline(const char *fileline, /*@out@*/filetype *result_t
size_p->len = sizeend - sizestart;
*result_section = section;
*result_priority = priority;
*result_basename = basename;
*result_basename = basefilename;
*result_architecture = architecture;
*result_name = name;
*result_type = type;
......
......@@ -205,12 +205,16 @@ static retvalue newentry(struct fileentry **entry,const char *fileline,const cha
if( strcmp(forcearchitecture,"source") != 0 &&
strcmp(e->architecture,"all") == 0 ) {
if( verbose > 2 )
fprintf(stderr,"Placing '%s' only in architecture '%s' as requested.\n",e->basename,forcearchitecture);
fprintf(stderr,
"Placing '%s' only in architecture '%s' as requested.\n",
e->basename, forcearchitecture);
free(e->architecture);
e->architecture = strdup(forcearchitecture);
} else if( strcmp(forcearchitecture,e->architecture) != 0) {
if( verbose > 1 )
fprintf(stderr,"Skipping '%s' as not for architecture '%s'.\n",e->basename,forcearchitecture);
fprintf(stderr,
"Skipping '%s' as not for architecture '%s'.\n",
e->basename, forcearchitecture);
freeentries(e);
return RET_NOTHING;
}
......@@ -256,15 +260,15 @@ static retvalue changes_addhashes(const char *filename, struct changes *changes,
struct hash_data data, size;
const char *fileline = filelines->values[i];
struct fileentry *e;
const char *basename;
const char *basefilename;
r = hashline_parse(filename, fileline, cs, &basename, &data, &size);
r = hashline_parse(filename, fileline, cs, &basefilename, &data, &size);
if( r == RET_NOTHING )
continue;
if( RET_WAS_ERROR(r) )
return r;
e = changes->files;
while( e != NULL && strcmp(e->basename, basename) != 0 )
while( e != NULL && strcmp(e->basename, basefilename) != 0 )
e = e->next;
if( e == NULL ) {
if( ignoresomefiles )
......@@ -274,7 +278,7 @@ static retvalue changes_addhashes(const char *filename, struct changes *changes,
continue;
fprintf(stderr,
"In '%s': file '%s' listed in '%s' but not in 'Files'\n",
filename, basename, changes_checksum_names[cs]);
filename, basefilename, changes_checksum_names[cs]);
return RET_ERROR;
}
if( e->hashes.hashes[cs_length].len != size.len ||
......@@ -282,7 +286,7 @@ static retvalue changes_addhashes(const char *filename, struct changes *changes,
size.start, size.len) != 0 ) {
fprintf(stderr,
"In '%s': file '%s' listed in '%s' with different size than in 'Files'\n",
filename, basename, changes_checksum_names[cs]);
filename, basefilename, changes_checksum_names[cs]);
return RET_ERROR;
}
e->hashes.hashes[cs] = data;
......@@ -536,7 +540,9 @@ static retvalue changes_fixfields(const struct distribution *distribution,const
// Let's just check here, perhaps
if( e->type == fe_UDEB &&
!strlist_in(&distribution->udebcomponents,e->component)) {
fprintf(stderr,"Cannot put file '%s' into component '%s', as it is not listed in UDebComponents!\n",e->basename,e->component);
fprintf(stderr,
"Cannot put file '%s' into component '%s', as it is not listed in UDebComponents!\n",
e->basename, e->component);
return RET_ERROR;
}
} else {
......@@ -636,7 +642,8 @@ static retvalue changes_check(const char *filename,struct changes *changes,/*@nu
while( e != NULL ) {
if( !strlist_in(&changes->architectures,e->architecture) ) {
if( !IGNORING_(surprisingarch,
"'%s' looks like architecture '%s', but this is not listed in the Architecture-Header!\n",e->basename,e->architecture))
"'%s' looks like architecture '%s', but this is not listed in the Architecture-Header!\n",
e->basename, e->architecture))
r = RET_ERROR;
}
if( e->type == fe_DSC ) {
......@@ -845,11 +852,11 @@ static retvalue changes_deleteleftoverfiles(struct changes *changes,int delete)
e->basename);
if( unlink(fullorigfilename) != 0 ) {
int e = errno;
int err = errno;
fprintf(stderr, "Error deleting '%s': %d=%s\n",
fullorigfilename, e, strerror(e));
r = RET_ERRNO(e);
RET_UPDATE(result,r);
fullorigfilename, err, strerror(err));
r = RET_ERRNO(err);
RET_UPDATE(result, r);
}
free(fullorigfilename);
}
......@@ -857,7 +864,7 @@ static retvalue changes_deleteleftoverfiles(struct changes *changes,int delete)
return result;
}
static retvalue changes_check_sourcefile(struct changes *changes, struct fileentry *dsc, struct database *database, const char *basename, const char *filekey, struct checksums **checksums_p) {
static retvalue changes_check_sourcefile(struct changes *changes, struct fileentry *dsc, struct database *database, const char *basefilename, const char *filekey, struct checksums **checksums_p) {
retvalue r;
bool dummy = false;
......@@ -884,7 +891,7 @@ static retvalue changes_check_sourcefile(struct changes *changes, struct fileent
// TODO: if this is included and a error occours, it currently stays.
// how can this be fixed?
return files_checkincludefile(database, changes->incomingdirectory,
basename, filekey, checksums_p, &dummy);
basefilename, filekey, checksums_p, &dummy);
}
static retvalue dsc_prepare(struct changes *changes, struct fileentry *dsc, struct database *database, struct distribution *distribution, const char *dscfilename){
......@@ -1235,13 +1242,16 @@ retvalue changes_add(struct database *database,trackingdb const tracks,const cha
return r;
}
if( distribution->trackingoptions.includechanges ) {
char *basename;
char *basefilename;
assert( changes->srcdirectory != NULL );
basename = calc_changes_basename(changes->source, changes->changesversion, &changes->architectures);
basefilename = calc_changes_basename(changes->source,
changes->changesversion,
&changes->architectures);
changes->changesfilekey =
calc_dirconcat(changes->srcdirectory,basename);
free(basename);
calc_dirconcat(changes->srcdirectory,
basefilename);
free(basefilename);
if( changes->changesfilekey == NULL ) {
changes_unincludefiles(database, changes);
changes_free(changes);
......
......@@ -368,7 +368,6 @@ retvalue dsc_add(struct database *database,const char *forcecomponent,const char
&pkg->deleteonfailure[i]);
}
}
free(origdirectory);
/* Calculate the chunk to include: */
......@@ -380,18 +379,21 @@ retvalue dsc_add(struct database *database,const char *forcecomponent,const char
free(pkg->dsc.control);
pkg->dsc.control = control;
} else {
free(origdirectory);
dsc_free(pkg, database);
return r;
}
if( interrupted() ) {
dsc_free(pkg, database);
free(origdirectory);
return RET_ERROR_INTERRUPTED;
}
if( tracks != NULL ) {
r = trackingdata_summon(tracks,pkg->dsc.name,pkg->dsc.version,&trackingdata);
if( RET_WAS_ERROR(r) ) {
free(origdirectory);
dsc_free(pkg, database);
return r;
}
......@@ -409,26 +411,21 @@ retvalue dsc_add(struct database *database,const char *forcecomponent,const char
/* delete source files, if they are to be */
if( ( RET_IS_OK(r) && delete >= D_MOVE ) ||
( r == RET_NOTHING && delete >= D_DELETE ) ) {
char *origdirectory, *fullfilename;
retvalue r2;
char *fullfilename;
r2 = dirs_getdirectory(dscfilename, &origdirectory);
if( RET_IS_OK(r2) ) {
for( i = 0 ; i < pkg->dsc.files.names.count ; i++ ) {
fullfilename = calc_dirconcat(origdirectory,
pkg->dsc.files.names.values[i]);
if( fullfilename == NULL ) {
r = RET_ERROR_OOM;
break;
}
if( isregularfile(fullfilename) )
deletefile(fullfilename);
free(fullfilename);
for( i = 0 ; i < pkg->dsc.files.names.count ; i++ ) {
fullfilename = calc_dirconcat(origdirectory,
pkg->dsc.files.names.values[i]);
if( fullfilename == NULL ) {
r = RET_ERROR_OOM;
break;
}
free(origdirectory);
if( isregularfile(fullfilename) )
deletefile(fullfilename);
free(fullfilename);
}
RET_ENDUPDATE(r, r2);
}
free(origdirectory);
dsc_free(pkg, database);
if( tracks != NULL ) {
......
......@@ -89,7 +89,7 @@ static retvalue read_data_tar(/*@out@*/char **list, /*@out@*/size_t *size, const
}
a = archive_read_data_skip(tar);
if( a != ARCHIVE_OK ) {
int e = archive_errno(tar);
e = archive_errno(tar);
if( e == -EINVAL ) {
r = RET_ERROR;
fprintf(stderr,
......@@ -111,7 +111,7 @@ static retvalue read_data_tar(/*@out@*/char **list, /*@out@*/size_t *size, const
}
}
if( a != ARCHIVE_EOF ) {
int e = archive_errno(tar);
e = archive_errno(tar);
if( e == -EINVAL ) {
r = RET_ERROR;
fprintf(stderr,
......
......@@ -313,7 +313,7 @@ static retvalue callexporthook(/*@null@*/const char *hook, const char *relfilena
int e;
if( dup2(io[1],3) < 0 ) {
int e = errno;
e = errno;
fprintf(stderr, "Error %d dup2'ing fd %d to 3: %s\n",
e, io[1], strerror(e));
exit(255);
......
......@@ -469,7 +469,7 @@ retvalue fakefilelist(struct database *database, const char *filekey) {
}
static const char header[] = "FILE LOCATION\n";
static const char separator[] = "\t ";
static const char separator_chars[] = "\t ";
static void filelist_writefiles(char *dir, size_t len,
struct filelist *files, struct filetorelease *file) {
......@@ -481,7 +481,8 @@ static void filelist_writefiles(char *dir, size_t len,
filelist_writefiles(dir,len,files->nextl,file);
(void)release_writedata(file,dir,len);
(void)release_writestring(file,files->name);
(void)release_writedata(file,separator,sizeof(separator)-1);
(void)release_writedata(file, separator_chars,
sizeof(separator_chars) - 1);
first = true;
for( i = 0 ; i < files->count ; i ++ ) {
if( !first )
......
......@@ -1036,7 +1036,7 @@ retvalue files_preinclude(struct database *database, const char *sourcefilename,
return RET_OK;
}
static retvalue checkimproveorinclude(struct database *database, const char *sourcedir, const char *basename, const char *filekey, struct checksums **checksums_p, bool *improving) {
static retvalue checkimproveorinclude(struct database *database, const char *sourcedir, const char *basefilename, const char *filekey, struct checksums **checksums_p, bool *improving) {
retvalue r;
struct checksums *checksums = NULL;
bool improves, copied = false;
......@@ -1059,7 +1059,7 @@ static retvalue checkimproveorinclude(struct database *database, const char *sou
}
}
if( r == RET_NOTHING ) {
char *sourcefilename = calc_dirconcat(sourcedir, basename);
char *sourcefilename = calc_dirconcat(sourcedir, basefilename);
if( sourcefilename == NULL ) {
free(fullfilename);
......@@ -1097,7 +1097,7 @@ static retvalue checkimproveorinclude(struct database *database, const char *sou
if( copied ) {
deletefile(fullfilename);
fprintf(stderr,
"ERROR: Unexpected content of file '%s/%s'!\n", sourcedir, basename);
"ERROR: Unexpected content of file '%s/%s'!\n", sourcedir, basefilename);
} else
// TODO: if the database only listed some of the currently supported checksums,
// and the caller of checkincludefile supplied some (which none yet does), but
......@@ -1123,7 +1123,7 @@ static retvalue checkimproveorinclude(struct database *database, const char *sou
return r;
}
retvalue files_checkincludefile(struct database *database, const char *sourcedir,const char *basename, const char *filekey, struct checksums **checksums_p, bool *newlyincluded_p) {
retvalue files_checkincludefile(struct database *database, const char *sourcedir, const char *basefilename, const char *filekey, struct checksums **checksums_p, bool *newlyincluded_p) {
char *sourcefilename, *fullfilename;
struct checksums *checksums;
retvalue r;
......@@ -1153,7 +1153,7 @@ retvalue files_checkincludefile(struct database *database, const char *sourcedir
fprintf(stderr,
"ERROR: '%s/%s' cannot be included as '%s'.\n"
"Already existing files can only be included again, if they are the same, but:\n",
sourcedir, basename, filekey);
sourcedir, basefilename, filekey);
checksums_printdifferences(stderr, checksums, *checksums_p);
checksums_free(checksums);
return RET_ERROR_WRONG_MD5;
......@@ -1163,7 +1163,7 @@ retvalue files_checkincludefile(struct database *database, const char *sourcedir
r = checksums_combine(&checksums, *checksums_p, NULL);
if( !RET_WAS_ERROR(r) )
r = checkimproveorinclude(database, sourcedir,
basename, filekey, &checksums, &improves);
basefilename, filekey, &checksums, &improves);
if( !RET_WAS_ERROR(r) && improves )
r = files_replace_checksums(database, filekey,
checksums);
......@@ -1176,7 +1176,7 @@ retvalue files_checkincludefile(struct database *database, const char *sourcedir
}
assert( sourcedir != NULL );
sourcefilename = calc_dirconcat(sourcedir, basename);
sourcefilename = calc_dirconcat(sourcedir, basefilename);
if( sourcefilename == NULL )
return RET_ERROR_OOM;
......
......@@ -564,28 +564,30 @@ static retvalue candidate_read(struct incoming *i, int ofs, struct candidate **r
static retvalue candidate_addfileline(struct incoming *i, struct candidate *c, const char *fileline) {
struct candidate_file **p, *n;
char *basename;
char *basefilename;
retvalue r;
n = calloc(1,sizeof(struct candidate_file));
if( n == NULL )
return RET_ERROR_OOM;
r = changes_parsefileline(fileline, &n->type, &basename,
r = changes_parsefileline(fileline, &n->type, &basefilename,
&n->h.hashes[cs_md5sum], &n->h.hashes[cs_length],
&n->section, &n->priority, &n->architecture, &n->name);
if( RET_WAS_ERROR(r) ) {
free(n);
return r;
}
n->ofs = strlist_ofs(&i->files, basename);
n->ofs = strlist_ofs(&i->files, basefilename);
if( n->ofs < 0 ) {
fprintf(stderr,"In '%s': file '%s' not found in the incoming dir!\n", i->files.values[c->ofs], basename);
free(basename);
fprintf(stderr,
"In '%s': file '%s' not found in the incoming dir!\n",
i->files.values[c->ofs], basefilename);
free(basefilename);
candidate_file_free(n);
return RET_ERROR_MISSING;
}
free(basename);
free(basefilename);
p = &c->files;
while( *p != NULL )
......@@ -600,21 +602,21 @@ static retvalue candidate_addhashes(struct incoming *i, struct candidate *c, enu
for( j = 0 ; j < lines->count ; j++ ) {
const char *fileline = lines->values[j];
struct candidate_file *f;
const char *basename;
const char *basefilename;
struct hash_data hash, size;
retvalue r;
r = hashline_parse(BASENAME(i, c->ofs), fileline, cs,
&basename, &hash, &size);
&basefilename, &hash, &size);
if( !RET_IS_OK(r) )
return r;
f = c->files;
while( f != NULL && strcmp(BASENAME(i, f->ofs), basename) != 0 )
while( f != NULL && strcmp(BASENAME(i, f->ofs), basefilename) != 0 )
f = f->next;
if( f == NULL ) {
fprintf(stderr,
"Warning: Ignoring file '%s' listed in '%s' but not in '%s' of '%s'!\n",
basename, changes_checksum_names[cs],
basefilename, changes_checksum_names[cs],
changes_checksum_names[cs_md5sum],
BASENAME(i, c->ofs));
continue;
......@@ -624,7 +626,7 @@ static retvalue candidate_addhashes(struct incoming *i, struct candidate *c, enu
size.start, size.len) != 0 ) {
fprintf(stderr,
"Error: Different size of '%s' listed in '%s' and '%s' of '%s'!\n",
basename, changes_checksum_names[cs],
basefilename, changes_checksum_names[cs],
changes_checksum_names[cs_md5sum],
BASENAME(i, c->ofs));
return RET_ERROR;
......@@ -757,7 +759,7 @@ static retvalue candidate_earlychecks(struct incoming *i, struct candidate *c) {
/* Is used before any other candidate fields are set */
static retvalue candidate_usefile(const struct incoming *i,const struct candidate *c,struct candidate_file *file) {
const char *basename;
const char *basefilename;
char *origfile,*tempfilename;
struct checksums *readchecksums;
retvalue r;
......@@ -767,17 +769,19 @@ static retvalue candidate_usefile(const struct incoming *i,const struct candidat
if( file->used && file->tempfilename != NULL )
return RET_OK;
assert(file->tempfilename == NULL);
basename = BASENAME(i,file->ofs);
for( p = basename; *p != '\0' ; p++ ) {
basefilename = BASENAME(i, file->ofs);
for( p = basefilename; *p != '\0' ; p++ ) {
if( (0x80 & *(const unsigned char *)p) != 0 ) {
fprintf(stderr, "Invalid filename '%s' listed in '%s': contains 8-bit characters\n", basename, BASENAME(i,c->ofs));
fprintf(stderr,
"Invalid filename '%s' listed in '%s': contains 8-bit characters\n",
basefilename, BASENAME(i, c->ofs));
return RET_ERROR;
}
}
tempfilename = calc_dirconcat(i->tempdir, basename);
tempfilename = calc_dirconcat(i->tempdir, basefilename);
if( tempfilename == NULL )
return RET_ERROR_OOM;
origfile = calc_dirconcat(i->directory, basename);
origfile = calc_dirconcat(i->directory, basefilename);
if( origfile == NULL ) {
free(tempfilename);
return RET_ERROR_OOM;
......@@ -796,8 +800,11 @@ static retvalue candidate_usefile(const struct incoming *i,const struct candidat
return RET_OK;
}
if( !checksums_check(file->checksums, readchecksums, &improves) ) {
fprintf(stderr, "ERROR: File '%s' does not match expectations:\n", basename);
checksums_printdifferences(stderr, file->checksums, readchecksums);
fprintf(stderr,
"ERROR: File '%s' does not match expectations:\n",
basefilename);
checksums_printdifferences(stderr,
file->checksums, readchecksums);
checksums_free(readchecksums);
deletefile(tempfilename);
free(tempfilename);
......@@ -964,7 +971,7 @@ static retvalue candidate_read_files(struct incoming *i, struct candidate *c) {
static retvalue candidate_preparechangesfile(struct database *database,const struct candidate *c,struct candidate_perdistribution *per) {
retvalue r;
char *basename, *filekey;
char *basefilename, *filekey;
struct candidate_package *package;
struct candidate_file *file;
const char *component = NULL;
......@@ -991,12 +998,13 @@ static retvalue candidate_preparechangesfile(struct database *database,const str
if( package == NULL )
return RET_ERROR_OOM;
basename = calc_changes_basename(c->source, c->changesversion, &c->architectures);
if( basename == NULL )
basefilename = calc_changes_basename(c->source, c->changesversion,
&c->architectures);
if( basefilename == NULL )
return RET_ERROR_OOM;
filekey = calc_filekey(component, c->source, basename);
free(basename);
filekey = calc_filekey(component, c->source, basefilename);
free(basefilename);
if( filekey == NULL )
return RET_ERROR_OOM;
......@@ -1073,7 +1081,7 @@ static retvalue prepare_deb(struct database *database,const struct incoming *i,c
return RET_OK;
}
static retvalue prepare_source_file(struct database *database, const struct incoming *i, const struct candidate *c, const char *filekey, const char *basename, struct checksums **checksums_p, int package_ofs, /*@out@*/const struct candidate_file **foundfile_p){
static retvalue prepare_source_file(struct database *database, const struct incoming *i, const struct candidate *c, const char *filekey, const char *basefilename, struct checksums **checksums_p, int package_ofs, /*@out@*/const struct candidate_file **foundfile_p){
struct candidate_file *f;
const struct checksums * const checksums = *checksums_p;
retvalue r;
......@@ -1081,7 +1089,7 @@ static retvalue prepare_source_file(struct database *database, const struct inco
f = c->files;
while( f != NULL && (f->checksums == NULL ||
strcmp(BASENAME(i, f->ofs), basename) != 0) )
strcmp(BASENAME(i, f->ofs), basefilename) != 0) )
f = f->next;
if( f == NULL ) {
......@@ -1100,7 +1108,7 @@ static retvalue prepare_source_file(struct database *database, const struct inco
if( f == NULL ) {
fprintf(stderr, "file '%s' is needed for '%s', not yet registered in the pool and not found in '%s'\n",
basename, BASENAME(i, package_ofs),
basefilename, BASENAME(i, package_ofs),
BASENAME(i, c->ofs));
return RET_ERROR;
}
......@@ -1109,7 +1117,7 @@ static retvalue prepare_source_file(struct database *database, const struct inco
if( !checksums_check(f->checksums, checksums, &improves) ) {
fprintf(stderr, "file '%s' has conflicting checksums listed in '%s' and '%s'!\n",
basename,
basefilename,
BASENAME(i, c->ofs),
BASENAME(i, package_ofs));
return RET_ERROR;
......@@ -1745,7 +1753,6 @@ static retvalue candidate_add(struct database *database, struct strlist *derefer
static retvalue process_changes(struct database *database, struct strlist *dereferenced, struct incoming *i, int ofs) {
struct candidate *c IFSTUPIDCC(=NULL);
struct candidate_file *file;
retvalue r;
int j,k;
bool broken = false, tried = false;
......@@ -1805,6 +1812,8 @@ static retvalue process_changes(struct database *database, struct strlist *deref
"No distribution found for '%s'!\n",
i->files.values[ofs]);
if( i->cleanup[cuf_on_deny] ) {
struct candidate_file *file;
i->delete[c->ofs] = true;
for( file = c->files ; file != NULL ; file = file->next ) {
// TODO: implement same-owner check
......@@ -1852,13 +1861,14 @@ retvalue process_incoming(struct database *database, struct strlist *dereference
return r;
for( j = 0 ; j < i->files.count ; j ++ ) {
const char *basename = i->files.values[j];
size_t l = strlen(basename);
const char *basefilename = i->files.values[j];
size_t l = strlen(basefilename);
#define C_SUFFIX ".changes"
#define C_LEN strlen(C_SUFFIX)
if( l <= C_LEN || strcmp(basename+(l-C_LEN),C_SUFFIX) != 0 )
if( l <= C_LEN ||
strcmp(basefilename + (l - C_LEN ), C_SUFFIX) != 0 )
continue;
if( changesfilename != NULL && strcmp(basename, changesfilename) != 0 )
if( changesfilename != NULL && strcmp(basefilename, changesfilename) != 0 )
continue;
/* a .changes file, check it */
r = process_changes(database, dereferenced, i, j);
......
......@@ -481,7 +481,7 @@ static int catchchildren(void) {
return returned;
}
static void feedchildren(bool wait) {
static void feedchildren(bool dowait) {
struct notification_process *p;
fd_set w;
int ret;
......@@ -498,7 +498,7 @@ static void feedchildren(bool wait) {
}
if( number == 0 )
return;
ret = select(number, NULL, &w, NULL, wait?NULL:&tv);
ret = select(number, NULL, &w, NULL, dowait?NULL:&tv);
if( ret < 0 ) {
// TODO...
return;
......
......@@ -2264,9 +2264,9 @@ ACTION_D(n, n, n, clearvanished) {
for( d = alldistributions; d != NULL ; d = d->next ) {
struct target *t;
for( t = d->targets; t != NULL ; t = t->next ) {
int i = strlist_ofs(&identifiers, t->identifier);
if( i >= 0 ) {
inuse[i] = true;
int ofs = strlist_ofs(&identifiers, t->identifier);
if( ofs >= 0 ) {
inuse[ofs] = true;
if( verbose > 6 )
printf(
"Marking '%s' as used.\n", t->identifier);