Commit cc788423 authored by Bernhard Link's avatar Bernhard Link

improve messages

parent b367496f
......@@ -262,24 +262,27 @@ static retvalue callexporthook(/*@null@*/const char *hook, const char *relfilena
status = pipe(io);
if( status < 0 ) {
int e = errno;
fprintf(stderr,"Error creating pipe: %d=%m!\n",e);
fprintf(stderr, "Error %d creating pipe: %s!\n", e, strerror(e));
return RET_ERRNO(e);
}
f = fork();
if( f < 0 ) {
int err = errno;
int e = errno;
(void)close(io[0]);
(void)close(io[1]);
fprintf(stderr,"Error while forking for exporthook: %d=%m\n",err);
return RET_ERRNO(err);
fprintf(stderr, "Error %d while forking for exporthook: %s\n",
e, strerror(e));
return RET_ERRNO(e);
}
if( f == 0 ) {
char *reltmpfilename;
int e;
if( dup2(io[1],3) < 0 ) {
fprintf(stderr,"Error dup2'ing fd %d to 3: %d=%m\n",
io[1],errno);
int e = errno;
fprintf(stderr, "Error %d dup2'ing fd %d to 3: %s\n",
e, io[1], strerror(e));
exit(255);
}
/* "Doppelt haelt besser": */
......@@ -295,7 +298,9 @@ static retvalue callexporthook(/*@null@*/const char *hook, const char *relfilena
}
(void)execl(hook, hook, release_dirofdist(release),
reltmpfilename, relfilename, mode, NULL);
fprintf(stderr, "Error while executing '%s': %d=%m\n", hook, errno);
e = errno;
fprintf(stderr, "Error %d while executing '%s': %s\n",
e, hook, strerror(e));
exit(255);
}
close(io[1]);
......@@ -312,7 +317,8 @@ static retvalue callexporthook(/*@null@*/const char *hook, const char *relfilena
r = read(io[0],buffer+already,999-already);
if( r < 0 ) {
int e = errno;
fprintf(stderr,"Error reading from exporthook: %d=%m!\n",e);
fprintf(stderr, "Error %d reading from exporthook: %s!\n",
e, strerror(e));
break;
}
......@@ -359,9 +365,10 @@ static retvalue callexporthook(/*@null@*/const char *hook, const char *relfilena
do {
c = waitpid(f,&status,WUNTRACED);
if( c < 0 ) {
int err = errno;
fprintf(stderr,"Error while waiting for hook '%s' to finish: %d=%m\n",hook,err);
return RET_ERRNO(err);
int e = errno;
fprintf(stderr,
"Error %d while waiting for hook '%s' to finish: %s\n", e, hook, strerror(e));
return RET_ERRNO(e);
}
} while( c != f );
if( WIFEXITED(status) ) {
......
......@@ -55,7 +55,7 @@ static retvalue try_extractcontrol(char **control, const char *debfile, bool bro
ret = pipe(pipe1);
if( ret < 0 ) {
int e = errno;
fprintf(stderr, "Error while creating pipe: %d=%s\n",e,strerror(e));
fprintf(stderr, "Error %d creating pipe: %s\n", e, strerror(e));
return RET_ERRNO(e);
}
......@@ -63,14 +63,14 @@ static retvalue try_extractcontrol(char **control, const char *debfile, bool bro
if( ret < 0 ) {
int e = errno;
close(pipe1[0]);close(pipe1[1]);
fprintf(stderr, "Error while creating pipe: %d=%s\n",e,strerror(e));
fprintf(stderr, "Error %d creating pipe: %s\n", e, strerror(e));
return RET_ERRNO(e);
}
ar = fork();
if( ar < 0 ) {
int e = errno;
fprintf(stderr, "Error while forking: %d=%s\n",e,strerror(e));
fprintf(stderr, "Error %d forking: %s\n", e, strerror(e));
result = RET_ERRNO(e);
close(pipe1[0]);close(pipe1[1]);
close(pipe2[0]);close(pipe2[1]);
......@@ -78,6 +78,7 @@ static retvalue try_extractcontrol(char **control, const char *debfile, bool bro
}
if( ar == 0 ) {
int e;
/* calling ar */
if( dup2(pipe1[1],1) < 0 )
exit(255);
......@@ -85,7 +86,9 @@ static retvalue try_extractcontrol(char **control, const char *debfile, bool bro
close(pipe2[0]);close(pipe2[1]);
//TODO without explicit path
ret = execl("/usr/bin/ar","ar","p",debfile,"control.tar.gz",NULL);
fprintf(stderr,"calling ar failed: %m\n");
e = errno;
fprintf(stderr, "ar call failed with error %d: %s\n",
e, strerror(e));
exit(254);
}
......@@ -93,11 +96,12 @@ static retvalue try_extractcontrol(char **control, const char *debfile, bool bro
if( tar < 0 ) {
int e = errno;
result = RET_ERRNO(e);
fprintf(stderr, "Error while forking: %d=%s\n",e,strerror(e));
fprintf(stderr, "Error %d forking: %s\n", e, strerror(e));
close(pipe1[0]);close(pipe1[1]);
close(pipe2[0]);close(pipe2[1]);
tar = -1;
} else if( tar == 0 ) {
int e;
/* calling tar */
if( dup2(pipe1[0],0) < 0 )
exit(255);
......@@ -108,7 +112,9 @@ static retvalue try_extractcontrol(char **control, const char *debfile, bool bro
//TODO without explicit path
execl("/bin/tar", "tar", "-xOzf", "-",
brokentar?"control":"./control", NULL);
fprintf(stderr,"calling tar failed: %m\n");
e = errno;
fprintf(stderr, "tar call failed with error %d: %s\n",
e, strerror(e));
exit(254);
}
......@@ -145,7 +151,7 @@ static retvalue try_extractcontrol(char **control, const char *debfile, bool bro
if( r == RET_NOTHING ) {
free(controlchunk);
controlchunk = NULL;
fprintf(stderr,"Got no control information from .deb!\n");
fprintf(stderr, "No control information found in .deb!\n");
/* only report error now if we haven't try everything yet */
if( brokentar )
r = RET_ERROR_MISSING;
......@@ -220,7 +226,7 @@ retvalue extractcontrol(char **control,const char *debfile) {
}
retvalue getfilelist(/*@out@*/char **filelist, /*@out@*/size_t *size, const char *debfile) {
fprintf(stderr, "Extracing of filelist currently not implemented without libarchive.\n");
fprintf(stderr, "Extraction of file list without libarchive currently not implemented.\n");
return RET_ERROR;
#if 0
int pipe1[2];
......@@ -242,7 +248,7 @@ retvalue getfilelist(/*@out@*/char **filelist, /*@out@*/size_t *size, const char
ret = pipe(pipe1);
if( ret < 0 ) {
int e = errno;
fprintf(stderr, "Error while creating pipe: %d=%s\n",e,strerror(e));
fprintf(stderr, "Error %d creating pipe: %s\n", e, strerror(e));
filelistcompressor_cancel(&c);
return RET_ERRNO(e);
}
......@@ -250,7 +256,7 @@ retvalue getfilelist(/*@out@*/char **filelist, /*@out@*/size_t *size, const char
ret = pipe(pipe2);
if( ret < 0 ) {
int e = errno;
fprintf(stderr, "Error while creating pipe: %d=%s\n",e,strerror(e));
fprintf(stderr, "Error %d creating pipe: %s\n", e, strerror(e));
close(pipe1[0]);close(pipe1[1]);
filelistcompressor_cancel(&c);
return RET_ERRNO(e);
......@@ -259,7 +265,7 @@ retvalue getfilelist(/*@out@*/char **filelist, /*@out@*/size_t *size, const char
ar = fork();
if( ar < 0 ) {
int e = errno;
fprintf(stderr, "Error while forking: %d=%s\n",e,strerror(e));
fprintf(stderr, "Error %d forking: %s\n", e, strerror(e));
result = RET_ERRNO(e);
close(pipe1[0]);close(pipe1[1]);
close(pipe2[0]);close(pipe2[1]);
......@@ -268,6 +274,7 @@ retvalue getfilelist(/*@out@*/char **filelist, /*@out@*/size_t *size, const char
}
if( ar == 0 ) {
int e;
/* calling ar */
if( dup2(pipe1[1],1) < 0 )
exit(255);
......@@ -275,7 +282,9 @@ retvalue getfilelist(/*@out@*/char **filelist, /*@out@*/size_t *size, const char
close(pipe2[0]);close(pipe2[1]);
//TODO without explicit path
ret = execl("/usr/bin/ar","ar","p",debfile,"data.tar.gz",NULL);
fprintf(stderr,"calling ar failed: %m\n");
e = errno;
fprintf(stderr, "ar call failed with error %d: %s\n",
e, strerror(e));
exit(254);
}
......@@ -283,11 +292,12 @@ retvalue getfilelist(/*@out@*/char **filelist, /*@out@*/size_t *size, const char
if( tar < 0 ) {
int e = errno;
result = RET_ERRNO(e);
fprintf(stderr, "Error while forking: %d=%s\n",e,strerror(e));
fprintf(stderr, "Error %d forking: %s\n", e, strerror(e));
close(pipe1[0]);close(pipe1[1]);
close(pipe2[0]);close(pipe2[1]);
tar = -1;
} else if( tar == 0 ) {
int e;
/* calling tar */
if( dup2(pipe1[0],0) < 0 )
exit(255);
......@@ -297,7 +307,9 @@ retvalue getfilelist(/*@out@*/char **filelist, /*@out@*/size_t *size, const char
close(pipe2[0]);close(pipe2[1]);
//TODO without explicit path
execl("/bin/tar","tar","-tzf","-",NULL);
fprintf(stderr,"calling tar failed: %m\n");
e = errno;
fprintf(stderr, "tar call failed with error %d: %s\n",
e, strerror(e));
exit(254);
}
......@@ -326,7 +338,7 @@ retvalue getfilelist(/*@out@*/char **filelist, /*@out@*/size_t *size, const char
bytes_read = read(pipe2[0], list+len, listsize-len-1);
if( bytes_read < 0 ) {
int e = errno;
fprintf(stderr, "Error reading from pipe: %d=%s\n",
fprintf(stderr, "Error %d reading from pipe: %s\n",
e, strerror(e));
result = RET_ERRNO(e);
break;
......@@ -334,7 +346,8 @@ retvalue getfilelist(/*@out@*/char **filelist, /*@out@*/size_t *size, const char
break;
else while( bytes_read > 0 ) {
if( list[len] == '\0' ) {
fprintf(stderr, "Unexpected NUL character from tar while getting filelist from %s!\n",debfile);
fprintf(stderr,
"Unexpected NUL character from tar while getting file list from %s!\n", debfile);
result = RET_ERROR;
break;
} else if( list[len] == '\n' ) {
......@@ -372,7 +385,8 @@ retvalue getfilelist(/*@out@*/char **filelist, /*@out@*/size_t *size, const char
}
} while( true );
if( len != last ) {
fprintf(stderr, "WARNING: unterminated output from tar over pipe while extracting filelist of %s\n",debfile);
fprintf(stderr,
"WARNING: unterminated output from tar pipe while extracting file list of %s\n", debfile);
list[len] = '\0';
fprintf(stderr, "The item '%s' might got lost.\n",
list+last);
......
......@@ -14,6 +14,8 @@
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#include "filecntl.h"
......@@ -46,11 +48,13 @@ void markcloseonexec(int fd) {
}
void deletefile(const char *fullfilename) {
int err;
int ret, e;
err = unlink(fullfilename);
if( err != 0 ) {
fprintf(stderr,"error while unlinking %s: %m\n",fullfilename);
ret = unlink(fullfilename);
if( ret != 0 ) {
e = errno;
fprintf(stderr, "error %d unlinking %s: %s\n",
e, fullfilename, strerror(e));
}
}
......
......@@ -568,7 +568,7 @@ static inline bool filelistcompressor_space(struct filelistcompressor *c, size_t
char *n;
if( c->size > 1024*1024*1024 ) {
fprintf(stderr, "Ridicilous long filelist!\n");
fprintf(stderr, "Ridiculously long file list!\n");
return false;
}
c->size = c->len + len + 2048;
......
......@@ -166,7 +166,8 @@ static inline retvalue filterlistfile_read(struct filterlistfile *n, const char
f = fopen(filename,"r");
if( f == NULL ) {
fprintf(stderr,"Cannot open %s for reading: %m!\n",filename);
fprintf(stderr, "Cannot open %s for reading: %s!\n",
filename, strerror(errno));
return RET_ERROR;
}
r = filterlistfile_parse(n, filename, f);
......
......@@ -213,7 +213,7 @@ retvalue space_check(struct devices *devices) {
}
if( device->blocksize != s.f_bsize ) {
fprintf(stderr,
"The blocksize of the filesystem belonging to '%s' has changed.\n"
"The block size of the filesystem belonging to '%s' has changed.\n"
"Either something was mounted or unmounted while reprepro was running,\n"
"or some symlinks were changed. Aborting as utterly confused.\n",
device->somepath);
......
......@@ -144,7 +144,7 @@ static retvalue incoming_prepare(struct incoming *i) {
ret = closedir(dir);
if( ret != 0 ) {
int e = errno;
fprintf(stderr, "Error scaning '%s': %s\n", i->directory, strerror(e));
fprintf(stderr, "Error scanning '%s': %s\n", i->directory, strerror(e));
return RET_ERRNO(e);
}
i->processed = calloc(i->files.count, sizeof(bool));
......@@ -230,7 +230,7 @@ CFfinishparse(incoming) {
}
if( i->default_into == NULL && i->allow.count == 0 ) {
fprintf(stderr,
"There ia neither a 'Allow' nor a 'Default' definition in rule '%s'\n"
"There is neither an 'Allow' nor a 'Default' definition in rule '%s'\n"
"(starting at line %u, ending at line %u of %s)!\n"
"Aborting as nothing would be let in.\n",
d->name,
......
......@@ -367,7 +367,7 @@ static retvalue notificator_parse(struct notificator *n, const char *confdir, st
if( c != EOF ) {
fprintf(stderr,
"Error parsing config file %s, line %u, column %u:\n"
"Unexpected data at end of notifier after scriptname '%s'\n",
"Unexpected data at end of notifier after script name '%s'\n",
config_filename(iter),
config_line(iter), config_column(iter),
script);
......@@ -452,7 +452,7 @@ static int catchchildren(void) {
p->arguments[0]);
} else if( WIFEXITED(status) && WEXITSTATUS(status) != 0 ) {
fprintf(stderr,
"Notification process '%s' returned with exitcode %d!\n",
"Notification process '%s' returned with exit code %d!\n",
p->arguments[0],
(int)(WEXITSTATUS(status)));
}
......
......@@ -1770,11 +1770,11 @@ ACTION_D(y, y, y, includedsc) {
assert( argc == 3 );
if( architecture != NULL && strcmp(architecture,"source") != 0 ) {
fprintf(stderr,"Cannot put a source-package anywhere else than in architecture 'source'!\n");
fprintf(stderr, "Cannot put a source package anywhere else than in architecture 'source'!\n");
return RET_ERROR;
}
if( packagetype != NULL && strcmp(packagetype,"dsc") != 0 ) {
fprintf(stderr,"Cannot put a source-package anywhere else than in type 'dsc'!\n");
fprintf(stderr, "Cannot put a source package anywhere else than in type 'dsc'!\n");
return RET_ERROR;
}
if( !endswith(argv[2],".dsc") && !IGNORING_(extension,
......@@ -1947,8 +1947,10 @@ ACTION_C(n, n, createsymlinks) {
if( ret < 0 && errno == ENOENT ) {
ret = symlink(d->codename,linkname);
if( ret != 0 ) {
r = RET_ERRNO(errno);
fprintf(stderr,"Error creating symlink %s->%s: %d=%m\n",linkname,d->codename,errno);
int e = errno;
r = RET_ERRNO(e);
fprintf(stderr,
"Error %d creating symlink %s->%s: %s\n", e, linkname, d->codename, strerror(e));
RET_UPDATE(result,r);
} else {
if( verbose > 0 ) {
......@@ -1977,8 +1979,10 @@ ACTION_C(n, n, createsymlinks) {
unlink(linkname);
ret = symlink(d->codename,linkname);
if( ret != 0 ) {
r = RET_ERRNO(errno);
fprintf(stderr,"Error creating symlink %s->%s: %d=%m\n",linkname,d->codename,errno);
int e = errno;
r = RET_ERRNO(e);
fprintf(stderr,
"Error %d creating symlink %s->%s: %s\n", e, linkname, d->codename, strerror(e));
RET_UPDATE(result,r);
} else {
if( verbose > 0 ) {
......@@ -1990,8 +1994,10 @@ ACTION_C(n, n, createsymlinks) {
}
}
} else {
r = RET_ERRNO(errno);
fprintf(stderr,"Error checking %s, perhaps not a symlink?: %d=%m\n",linkname,errno);
int e = errno;
r = RET_ERRNO(e);
fprintf(stderr,
"Error %d checking %s, perhaps not a symlink?: %s\n", e, linkname, strerror(e));
RET_UPDATE(result,r);
}
......@@ -2491,7 +2497,7 @@ static retvalue callaction(const struct action *action, int argc, const char *ar
} else {
fprintf(stderr,
"Not deleting possibly left over files due to previous errors.\n"
"(To avoid the files in the still existing index files vanishing)\n"
"(To keep the files in the still existing index files from vanishing)\n"
"Use dumpunreferenced/deleteunreferenced to show/delete files without referenes.\n");
}
}
......
......@@ -202,7 +202,7 @@ static retvalue pull_initdistribution(struct pull_distribution **pp,
rule = rule->next;
if( rule == NULL ) {
fprintf(stderr,
"Error: Unknown pull-rule '%s' in distribution '%s'!\n",
"Error: Unknown pull rule '%s' in distribution '%s'!\n",
name, distribution->codename);
return RET_ERROR_MISSING;
}
......@@ -637,7 +637,8 @@ static upgrade_decision ud_decide_by_rule(void *privdata, const char *package,UN
return UD_HOLD;
case flt_error:
/* cannot yet be handled! */
fprintf(stderr,"Packagename marked to be unexpected('error'): '%s'!\n",package);
fprintf(stderr,
"Package name marked to be unexpected('error'): '%s'!\n", package);
return UD_ERROR;
case flt_install:
break;
......@@ -705,12 +706,12 @@ static retvalue pull_search(FILE *out,struct database *database,struct pull_dist
d->distribution->udeb_override != NULL ) {
if( verbose >= 0 )
fprintf(stderr,
"Warning: Override-Files of '%s' ignored as not yet supported while updating!\n",
"Warning: Override files of '%s' ignored as not yet supported while updating!\n",
d->distribution->codename);
}
if( d->distribution->tracking != dt_NONE ) {
fprintf(stderr,
"WARNING: Pull does not yet update trackingdata. Trackingdata of %s will be outdated!\n",
"WARNING: Pull does not yet update tracking data. Tracking data of %s will be outdated!\n",
d->distribution->codename);
}
......
......@@ -39,7 +39,7 @@ retvalue release_getchecksums(const char *releasefile, struct checksumsarray *ou
r = chunk_getextralinelist(chunk,"MD5Sum",&files);
free(chunk);
if( r == RET_NOTHING ) {
fprintf(stderr,"Missing MD5Sum-field in Release file!\n");
fprintf(stderr, "Missing 'MD5Sum' field in Release file!\n");
return RET_ERROR;
}
if( RET_WAS_ERROR(r) )
......
......@@ -69,7 +69,7 @@ retvalue readtextfilefd(int fd, const char *source, char **data, size_t *len) {
assert( readdata <= buffersize );
if( readdata + 1024 >= buffersize ) {
if( buffersize >= 10*1024*1024 ) {
fprintf(stderr, "Ridicilous large %s\n", source);
fprintf(stderr, "Ridiculously large %s\n", source);
free(buffer);
return RET_ERROR;
}
......
......@@ -436,8 +436,8 @@ static retvalue openfile(const char *dirofdist, struct openfile *f) {
f->fd = open(f->fulltemporaryfilename,O_WRONLY|O_CREAT|O_EXCL|O_NOCTTY,0666);
if( f->fd < 0 ) {
int e = errno;
fprintf(stderr,"Error opening file %s for writing: %m\n",
f->fulltemporaryfilename);
fprintf(stderr, "Error %d opening file %s for writing: %s\n",
e, f->fulltemporaryfilename, strerror(e));
return RET_ERRNO(e);
}
return RET_OK;
......@@ -459,8 +459,9 @@ static retvalue writetofile(struct openfile *file, const unsigned char *data, si
int e = errno;
if( e == EAGAIN || e == EINTR )
continue;
fprintf(stderr,"Error writing to %s: %d=%m\n",
file->fullfinalfilename,e);
fprintf(stderr, "Error %d writing to %s: %s\n",
e, file->fullfinalfilename,
strerror(e));
return RET_ERRNO(e);
}
}
......@@ -1222,14 +1223,20 @@ retvalue release_finish(/*@only@*/struct release *release, struct distribution *
e = unlink(file->fulltemporaryfilename);
if( e < 0 ) {
e = errno;
fprintf(stderr,"Error deleting %s: %m. (Will be ignored)\n",file->fulltemporaryfilename);
fprintf(stderr,
"Error %d deleting %s: %s. (Will be ignored)\n",
e, file->fulltemporaryfilename,
strerror(e));
}
} else if( file->fulltemporaryfilename != NULL ) {
e = rename(file->fulltemporaryfilename,
file->fullfinalfilename);
if( e < 0 ) {
e = errno;
fprintf(stderr,"Error moving %s to %s: %d=%m!\n",file->fulltemporaryfilename,file->fullfinalfilename,e);
fprintf(stderr, "Error %d moving %s to %s: %s!\n",
e, file->fulltemporaryfilename,
file->fullfinalfilename,
strerror(e));
r = RET_ERRNO(e);
/* after something was done, do not stop
* but try to do as much as possible */
......
......@@ -124,7 +124,7 @@ static inline retvalue containskey(const char *key, const char *fingerprint) {
p++;
kl = p-keypart;
if( kl < 8 ) {
fprintf(stderr, "Too short keyid specified (less than 8 characters) in '%s'!\n",key);
fprintf(stderr, "Key id too short (less than 8 characters) in '%s'!\n",key);
return RET_ERROR;
}
if( kl < fl && strncasecmp(fingerprint+fl-kl,keypart,kl) == 0 )
......@@ -291,7 +291,7 @@ retvalue signature_check(const char *options, const char *releasegpg, const char
retvalue signature_sign(const char *options, const char *filename, const char *signaturename) {
retvalue r;
int ret;
int ret, e;
#ifdef HAVE_LIBGPGME
gpgme_error_t err;
gpgme_data_t dh,dh_gpg;
......@@ -304,8 +304,9 @@ retvalue signature_sign(const char *options, const char *filename, const char *s
/* make sure it does not already exists */
ret = unlink(signaturename);
if( ret != 0 && errno != ENOENT ) {
fprintf(stderr,"Could not remove '%s' to prepare replacement: %m\n",signaturename);
if( ret != 0 && (e = errno) != ENOENT ) {
fprintf(stderr, "Could not remove '%s' to prepare replacement: %s\n",
signaturename, strerror(e));
return RET_ERROR;
}
......@@ -453,7 +454,7 @@ retvalue signature_sign(const char *options, const char *filename, const char *s
return r;
#else /* HAVE_LIBGPGME */
fprintf(stderr,
"ERROR: Cannot creature signatures as this reprepro binary is compiled with support\n"
"ERROR: Cannot creature signatures as this reprepro binary is not compiled with support\n"
"for libgpgme.\n"); // TODO: "Only running external programs is supported.\n"
return RET_ERROR_GPGME;
#endif /* HAVE_LIBGPGME */
......@@ -1022,9 +1023,9 @@ retvalue signedfile_finalize(struct signedfile *f, bool *toolate) {
e = rename(f->newsignfilename, f->signfilename);
if( e < 0 ) {
e = errno;
fprintf(stderr, "Error moving %s to %s: %d=%m!\n",
fprintf(stderr, "Error %d moving %s to %s: %s!\n", e,
f->newsignfilename,
f->signfilename, e);
f->signfilename, strerror(e));
result = RET_ERRNO(e);
/* after something was done, do not stop
* but try to do as much as possible */
......@@ -1040,9 +1041,9 @@ retvalue signedfile_finalize(struct signedfile *f, bool *toolate) {
e = rename(f->newplainfilename, f->plainfilename);
if( e < 0 ) {
e = errno;
fprintf(stderr, "Error moving %s to %s: %d=%m!\n",
fprintf(stderr, "Error %d moving %s to %s: %s!\n", e,
f->newplainfilename,
f->plainfilename, e);
f->plainfilename, strerror(e));
r = RET_ERRNO(e);
RET_UPDATE(result, r);
} else {
......
......@@ -122,7 +122,7 @@ retvalue sources_getname(UNUSED(struct target *t),const char *control,char **pac
if( RET_WAS_ERROR(r) )
return r;
if( r == RET_NOTHING ) {
fprintf(stderr,"Did not find Package name in chunk:'%s'\n",control);
fprintf(stderr, "Missing 'Package' field in chunk:'%s'\n", control);
return RET_ERROR;
}
return r;
......@@ -134,7 +134,7 @@ retvalue sources_getversion(UNUSED(struct target *t),const char *control,char **
if( RET_WAS_ERROR(r) )
return r;
if( r == RET_NOTHING ) {
fprintf(stderr,"Did not find Version in chunk:'%s'\n",control);
fprintf(stderr, "Missing 'Version' field in chunk:'%s'\n", control);
return RET_ERROR;
}
return r;
......@@ -327,7 +327,7 @@ retvalue sources_retrack(const char *sourcename, const char *chunk, trackingdb t
r = chunk_getvalue(chunk,"Version",&sourceversion);
if( r == RET_NOTHING ) {
fprintf(stderr,"Did not find Version in chunk:'%s'\n",chunk);
fprintf(stderr, "Missing 'Version' field in chunk:'%s'\n", chunk);
r = RET_ERROR;
}
if( RET_WAS_ERROR(r) ) {
......@@ -336,7 +336,7 @@ retvalue sources_retrack(const char *sourcename, const char *chunk, trackingdb t
r = sources_getfilekeys(chunk, &filekeys);
if( r == RET_NOTHING ) {
fprintf(stderr,"Malformed source control:'%s'\n",chunk);
fprintf(stderr, "Malformed source control:'%s'\n", chunk);
r = RET_ERROR;
}
if( RET_WAS_ERROR(r) ) {
......@@ -379,7 +379,7 @@ retvalue sources_getsourceandversion(UNUSED(struct target *t),const char *chunk,
r = chunk_getvalue(chunk,"Version",&sourceversion);
if( r == RET_NOTHING ) {
fprintf(stderr,"Did not find Version in chunk:'%s'\n",chunk);
fprintf(stderr, "Missing 'Version' field in chunk:'%s'\n", chunk);
r = RET_ERROR;
}
if( RET_WAS_ERROR(r) ) {
......
......@@ -2338,7 +2338,7 @@ static int execute_command(int argc, char **argv, const char *changesfilename, b
if( strcasecmp(command, "verify") == 0 ) {
if( argc > 1 ) {
fprintf(stderr, "Too many argument!\n");
fprintf(stderr, "Too many arguments!\n");
r = RET_ERROR;
} else if( file_exists )
r = verify(changesfilename, changesdata);
......@@ -2471,7 +2471,7 @@ int main(int argc,char *argv[]) {
changesfilename = argv[optind];
if( strcmp(changesfilename,"-") != 0 && !endswith(changesfilename,".changes") ) {
fprintf(stderr, "first argument does not ending with '.changes'\n");
fprintf(stderr, "first argument not ending with '.changes'\n");
exit(EXIT_FAILURE);
}
file_exists = isregularfile(changesfilename);
......
......@@ -674,14 +674,14 @@ retvalue tracking_parse(struct distribution *d, struct configiterator *iter) {
if( modecount > 1 ) {
fprintf(stderr,
"Error parsing config file %s, line %u:\n"
"Only one of 'keep','all' or 'minimal' can be in one Tracking-header.\n",
"Only one of 'keep','all' or 'minimal' can be in one Tracking header.\n",
config_filename(iter), config_line(iter));
return RET_ERROR;
}
if( modecount < 1 ) {
fprintf(stderr,
"Error parsing config file %s, line %u, column %u:\n"
"Tracking-mode ('keep','all' or 'minimal') expected.\n",
"Tracking mode ('keep','all' or 'minimal') expected.\n",
config_filename(iter), config_line(iter), config_column(iter));
return RET_ERROR;
}
......
......@@ -419,7 +419,7 @@ static void checkpatternsforunused(const struct update_pattern *patterns, const
if( found[i] )
continue;
fprintf(stderr,
"Warning: Update-pattern '%s' wants to put something in architecture '%s',\n"
"Warning: Update pattern '%s' wants to put something in architecture '%s',\n"
"but no distribution using that rule has an architecture of that name.\n",
p->name, p->architectures_into.values[i]);
}
......@@ -437,7 +437,7 @@ static void checkpatternsforunused(const struct update_pattern *patterns, const
if( found[i] )
continue;
fprintf(stderr,
"Warning: Update-pattern '%s' wants to put something in component '%s',\n"
"Warning: Update pattern '%s' wants to put something in component '%s',\n"
"but no distribution using that rule has an component of that name.\n",
p->name, p->components_into.values[i]);
}
......@@ -455,7 +455,7 @@ static void checkpatternsforunused(const struct update_pattern *patterns, const
if( found[i] )
continue;
fprintf(stderr,
"Warning: Update-pattern '%s' wants to put something in udebcomponent '%s',\n"
"Warning: Update pattern '%s' wants to put something in udebcomponent '%s',\n"
"but no distribution using that rule has an udebcomponent of that name.\n",
p->name, p->udebcomponents_into.values[i]);
}
......@@ -878,7 +878,8 @@ static retvalue listclean_distribution(const char *listdir,DIR *dir, const char
return RET_OK;
/* this should not happen... */
e = errno;
fprintf(stderr,"Error reading dir '%s': %d=%m!\n",listdir,e);
fprintf(stderr, "Error %d reading dir '%s': %s!\n",
e, listdir, strerror(e));
return RET_ERRNO(e);
}
namelen = _D_EXACT_NAMLEN(r);
......@@ -901,7 +902,8 @@ static retvalue listclean_distribution(const char *listdir,DIR *dir, const char
e = unlink(fullfilename);
if( e != 0 ) {
e = errno;
fprintf(stderr,"Error unlinking '%s': %d=%m.\n",fullfilename,e);
fprintf(stderr, "Error %d unlinking '%s': %s.\n",
e, fullfilename, strerror(e));
free(fullfilename);
return RET_ERRNO(e);
}
......@@ -1172,7 +1174,10 @@ static inline retvalue queueindex(struct update_index *index) {
}
return r;
}
fprintf(stderr,"Could not find '%s' within the Releasefile of '%s':\n'%s'\n",index->upstream,origin->pattern->name,origin->releasefile);
fprintf(stderr,
"Could not find '%s' within the Release file of '%s':\n'%s'\n",
index->upstream, origin->pattern->name,
origin->releasefile);
return RET_ERROR_WRONG_MD5;
}
......@@ -1232,15 +1237,19 @@ static retvalue calllisthook(const char *listhook,struct update_index *index) {
return RET_ERROR_OOM;
f = fork();
if( f < 0 ) {
int err = errno;
int e = errno;
free(newfilename);
fprintf(stderr,"Error while forking for listhook: %d=%m\n",err);
return RET_ERRNO(err);
fprintf(stderr, "Error %d while forking for listhook: %s\n",
e, strerror(e));
return RET_ERRNO(e);
}
if( f == 0 ) {
int e;
(void)closefrom(3);
execl(listhook,listhook,index->filename,newfilename,NULL);
fprintf(stderr,"Error while executing '%s': %d=%m\n",listhook,errno);
e = errno;
fprintf(stderr, "Error %d while executing '%s': %s\n",
e, listhook, strerror(e));
exit(255);
}
if( verbose > 5 )
......@@ -1251,9 +1260,10 @@ static retvalue calllisthook(const char *listhook,struct update_index *index) {
do {
c = waitpid(f,&status,WUNTRACED);
if( c < 0 ) {
int err = errno;
fprintf(stderr,"Error while waiting for hook '%s' to finish: %d=%m\n",listhook,err);
return RET_ERRNO(err);
int e = errno;
fprintf(stderr, "Error %d while waiting for hook '%s' to finish: %s\n",
e, listhook, strerror(e));
return RET_ERRNO(e);
}
} while( c != f );
if( WIFEXITED(status) ) {
......@@ -1321,7 +1331,8 @@ static upgrade_decision ud_decide_by_pattern(void *privdata, const char *package
return UD_HOLD;
case flt_error:
/* cannot yet be handled! */
fprintf(stderr,"Packagename marked to be unexpected('error'): '%s'!\n",package);
fprintf(stderr,
"Package name marked to be unexpected('error'): '%s'!\n", package);
return UD_ERROR;
case flt_install:
break;
......
......@@ -129,7 +129,7 @@ static retvalue save_package_version(struct upgradelist *upgrade, const char *pa
/* this should only happen if the underlying
* database-method get changed, so just throwing