diff options
author | Guillem Jover <guillem@debian.org> | 2010-11-01 08:18:28 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2010-11-19 05:21:14 +0100 |
commit | c6ea15b9850f26ea3b5a13667396c89e00aa9890 (patch) | |
tree | 9da3c56846f1e9f0e75d3ac619713c6467af472a /src | |
parent | 7ee4f4f2ef5ca3d9fa1426ac93f78ead2280bc36 (diff) | |
download | dpkg-c6ea15b9850f26ea3b5a13667396c89e00aa9890.tar.gz |
Cleanup white spaces
Remove trailing spaces. Remove blank lines not separating different code
blocks. Remove blank lines at the end of the file.
Diffstat (limited to 'src')
-rw-r--r-- | src/archives.c | 42 | ||||
-rw-r--r-- | src/cleanup.c | 8 | ||||
-rw-r--r-- | src/depcon.c | 35 | ||||
-rw-r--r-- | src/divertdb.c | 1 | ||||
-rw-r--r-- | src/enquiry.c | 8 | ||||
-rw-r--r-- | src/errors.c | 4 | ||||
-rw-r--r-- | src/filesdb.c | 14 | ||||
-rw-r--r-- | src/filesdb.h | 2 | ||||
-rw-r--r-- | src/help.c | 18 | ||||
-rw-r--r-- | src/main.c | 5 | ||||
-rw-r--r-- | src/main.h | 2 | ||||
-rw-r--r-- | src/packages.c | 10 | ||||
-rw-r--r-- | src/processarc.c | 48 | ||||
-rw-r--r-- | src/querycmd.c | 15 | ||||
-rw-r--r-- | src/remove.c | 38 | ||||
-rw-r--r-- | src/select.c | 2 | ||||
-rw-r--r-- | src/statcmd.c | 1 | ||||
-rw-r--r-- | src/statdb.c | 1 | ||||
-rw-r--r-- | src/trigcmd.c | 1 | ||||
-rw-r--r-- | src/trigproc.c | 1 | ||||
-rw-r--r-- | src/update.c | 4 |
21 files changed, 122 insertions, 138 deletions
diff --git a/src/archives.c b/src/archives.c index 045d2773f..49c7c7eaa 100644 --- a/src/archives.c +++ b/src/archives.c @@ -125,7 +125,7 @@ filesavespackage(struct fileinlist *file, { struct filepackages_iterator *iter; struct pkginfo *divpkg, *thirdpkg; - + debug(dbg_eachfiledetail,"filesavespackage file `%s' package %s", file->namenode->name,pkgtobesaved->name); @@ -178,7 +178,7 @@ filesavespackage(struct fileinlist *file, void cu_pathname(int argc, void **argv) { ensure_pathname_nonexisting((char*)(argv[0])); -} +} int tarfileread(void *ud, char *buf, int len) { struct tarcontext *tc= (struct tarcontext*)ud; @@ -222,7 +222,7 @@ does_replace(struct pkginfo *newpigp, struct pkginfoperfile *newpifp, struct pkginfo *oldpigp, struct pkginfoperfile *oldpifp) { struct dependency *dep; - + debug(dbg_depcon,"does_replace new=%s old=%s (%s)",newpigp->name, oldpigp->name, versiondescribe(&oldpifp->version, vdew_always)); for (dep= newpifp->depends; dep; dep= dep->next) { @@ -329,19 +329,19 @@ int secure_remove(const char *filename) { int r, e; - + if (!rmdir(filename)) { debug(dbg_eachfiledetail, "secure_remove '%s' rmdir OK", filename); return 0; } - + if (errno != ENOTDIR) { e= errno; debug(dbg_eachfiledetail, "secure_remove '%s' rmdir %s", filename, strerror(e)); errno= e; return -1; } - + r = secure_unlink(filename); e = errno; debug(dbg_eachfiledetail, "secure_remove '%s' unlink %s", @@ -352,7 +352,7 @@ secure_remove(const char *filename) struct fileinlist *addfiletolist(struct tarcontext *tc, struct filenamenode *namenode) { struct fileinlist *nifd; - + nifd= obstack_alloc(&tar_obs, sizeof(struct fileinlist)); nifd->namenode= namenode; nifd->next = NULL; @@ -491,7 +491,7 @@ tarobject(void *ctx, struct tar_entry *ti) usename= conffderefn.buf; debug(dbg_conff,"tarobject fnnf_new_conff deref=`%s'",usename); } - + setupfnamevbs(usename); statr= lstat(fnamevb.buf,&stab); @@ -703,7 +703,7 @@ tarobject(void *ctx, struct tar_entry *ti) if (r > 0) if (safe_read(tc->backendpipe, databuf, TARBLKSZ - r) == -1) ohshite(_("error reading from dpkg-deb pipe")); - if (nifd->namenode->statoverride) + if (nifd->namenode->statoverride) debug(dbg_eachfile, "tarobject ... stat override, uid=%d, gid=%d, mode=%04o", nifd->namenode->statoverride->uid, nifd->namenode->statoverride->gid, @@ -732,13 +732,13 @@ tarobject(void *ctx, struct tar_entry *ti) ohshite(_("error creating device `%.255s'"), ti->name); debug(dbg_eachfiledetail, "tarobject chardev"); newtarobject_allmodes(fnamenewvb.buf, st); - break; + break; case tar_filetype_blockdev: if (mknod(fnamenewvb.buf, S_IFBLK, ti->dev)) ohshite(_("error creating device `%.255s'"), ti->name); debug(dbg_eachfiledetail, "tarobject blockdev"); newtarobject_allmodes(fnamenewvb.buf, st); - break; + break; case tar_filetype_hardlink: varbufreset(&hardlinkfn); varbufaddstr(&hardlinkfn,instdir); varbufaddc(&hardlinkfn,'/'); @@ -942,7 +942,7 @@ try_deconfigure_can(bool (*force_p)(struct deppossi *), struct pkginfo *pkg, struct pkginfo *removal, const char *why) { struct pkg_deconf_list *newdeconf; - + if (force_p && force_p(pdep)) { warning(_("ignoring dependency problem with %s:\n%s"), action, why); return 2; @@ -1141,7 +1141,7 @@ void check_conflict(struct dependency *dep, struct pkginfo *pkg, ohshit(_("conflicting packages - not installing %.250s"),pkg->name); warning(_("ignoring conflict, may proceed anyway!")); varbuf_destroy(&conflictwhy); - + return; } @@ -1150,11 +1150,11 @@ void cu_cidir(int argc, void **argv) { char *cidirrest= (char*)argv[1]; cidirrest[-1] = '\0'; ensure_pathname_nonexisting(cidir); -} +} void cu_fileslist(int argc, void **argv) { destroyobstack(); -} +} void archivefiles(const char *const *argv) { const char *volatile thisarg; @@ -1176,12 +1176,11 @@ void archivefiles(const char *const *argv) { checkpath(); log_message("startup archives %s", cipaction->olong); - + if (f_recursive) { - if (!*argv) badusage(_("--%s --recursive needs at least one path argument"),cipaction->olong); - + m_pipe(pi); fc = subproc_fork(); if (!fc) { @@ -1229,7 +1228,7 @@ void archivefiles(const char *const *argv) { varbufaddc(&findoutput,0); varbufaddc(&findoutput,0); - + arglist= m_malloc(sizeof(char*)*(nfiles+1)); p= findoutput.buf; i=0; while (*p) { @@ -1238,13 +1237,10 @@ void archivefiles(const char *const *argv) { } arglist[i] = NULL; argp= arglist; - } else { - if (!*argv) badusage(_("--%s needs at least one package archive file argument"), cipaction->olong); argp= argv; - } currenttime = time(NULL); @@ -1262,7 +1258,7 @@ void archivefiles(const char *const *argv) { ensure_diversions(); ensure_statoverrides(); - + while ((thisarg = *argp++) != NULL) { if (setjmp(ejbuf)) { pop_error_context(ehflag_bombout); diff --git a/src/cleanup.c b/src/cleanup.c index fa9b056e8..b6c462bac 100644 --- a/src/cleanup.c +++ b/src/cleanup.c @@ -70,12 +70,12 @@ void cu_installnew(int argc, void **argv) { struct stat stab; cleanup_pkg_failed++; cleanup_conflictor_failed++; - + namenode= nifd->namenode; debug(dbg_eachfile,"cu_installnew `%s' flags=%o",namenode->name,namenode->flags); - + setupfnamevbs(namenode->name); - + if (!(namenode->flags & fnnf_new_conff) && !lstat(fnametmpvb.buf,&stab)) { /* OK, <foo>.dpkg-tmp exists. Remove <foo> and * restore <foo>.dpkg-tmp ... */ @@ -130,7 +130,7 @@ void cu_prermupgrade(int argc, void **argv) { */ void ok_prermdeconfigure(int argc, void **argv) { struct pkginfo *deconf= (struct pkginfo*)argv[0]; - + if (cipaction->arg == act_install) add_to_queue(deconf); } diff --git a/src/depcon.c b/src/depcon.c index 41032f7f0..b692218e0 100644 --- a/src/depcon.c +++ b/src/depcon.c @@ -53,6 +53,7 @@ foundcyclebroken(struct cyclesofarlink *thislink, struct cyclesofarlink *sofar, if(!possi) return false; + /* We're investigating the dependency ‘possi’ to see if it * is part of a loop. To this end we look to see whether the * depended-on package is already one of the packages whose @@ -62,7 +63,7 @@ foundcyclebroken(struct cyclesofarlink *thislink, struct cyclesofarlink *sofar, /* If not, we do a recursive search on it to see what we find. */ if (!sol) return findbreakcyclerecursive(dependedon, thislink); - + debug(dbg_depcon,"found cycle"); /* Right, we now break one of the links. We prefer to break * a dependency of a package without a postinst script, as @@ -80,11 +81,14 @@ foundcyclebroken(struct cyclesofarlink *thislink, struct cyclesofarlink *sofar, ohshite(_("unable to check for existence of `%.250s'"),postinstfilename); } } + /* Now we have either a package with no postinst, or the other * occurrence of the current package in the list. */ sol->possi->cyclebreak = true; + debug(dbg_depcon, "cycle broken at %s -> %s", sol->possi->up->up->name, sol->possi->ed->name); + return true; } @@ -105,7 +109,7 @@ findbreakcyclerecursive(struct pkginfo *pkg, struct cyclesofarlink *sofar) if (pkg->clientdata->color == black) return false; pkg->clientdata->color = gray; - + if (f_debug & dbg_depcondetail) { struct varbuf str_pkgs = VARBUF_INIT; @@ -153,7 +157,7 @@ findbreakcycle(struct pkginfo *pkg) { struct pkgiterator *iter; struct pkginfo *tpkg; - + /* Clear the visited flag of all packages before we traverse them. */ iter = pkg_db_iter_new(); while ((tpkg = pkg_db_iter_next(iter))) { @@ -200,7 +204,7 @@ void describedepcon(struct varbuf *addto, struct dependency *dep) { varbufprintf(addto, fmt, dep->up->name, depstr.buf); varbuf_destroy(&depstr); } - + /* * *whynot must already have been initialized; it need not be * empty though - it will be reset before use. @@ -237,7 +241,7 @@ depisok(struct dependency *dep, struct varbuf *whynot, dep->type == dep_breaks || dep->type == dep_conflicts || dep->type == dep_recommends || dep->type == dep_suggests || dep->type == dep_enhances); - + if (canfixbyremove) *canfixbyremove = NULL; @@ -271,11 +275,10 @@ depisok(struct dependency *dep, struct varbuf *whynot, varbufaddc(whynot, ' '); describedepcon(whynot, dep); varbufaddc(whynot,'\n'); - + /* TODO: Check dep_enhances as well. */ if (dep->type == dep_depends || dep->type == dep_predepends || dep->type == dep_recommends || dep->type == dep_suggests ) { - /* Go through the alternatives. As soon as we find one that * we like, we return ‘true’ straight away. Otherwise, when we get to * the end we'll have accumulated all the reasons in whynot and @@ -349,7 +352,6 @@ depisok(struct dependency *dep, struct varbuf *whynot, /* If there was no version specified we try looking for Providers. */ if (possi->verrel == dvr_none) { - /* See if the package we're about to install Provides it. */ for (provider= possi->ed->available.depended; provider; @@ -364,14 +366,14 @@ depisok(struct dependency *dep, struct varbuf *whynot, provider; provider = provider->rev_next) { if (provider->up->type != dep_provides) continue; - + switch (provider->up->up->clientdata->istobe) { case itb_installnew: /* Don't pay any attention to the Provides field of the * currently-installed version of the package we're trying * to install. We dealt with that by using the available * information above. */ - continue; + continue; case itb_remove: sprintf(linebuf, _(" %.250s provides %.250s but is to be removed.\n"), provider->up->up->name, possi->ed->name); @@ -393,7 +395,7 @@ depisok(struct dependency *dep, struct varbuf *whynot, } varbufaddstr(whynot, linebuf); } - + if (!*linebuf) { /* If the package wasn't installed at all, and we haven't said * yet why this isn't satisfied, we should say so now. */ @@ -404,9 +406,7 @@ depisok(struct dependency *dep, struct varbuf *whynot, } return false; - } else { - /* It's conflicts or breaks. There's only one main alternative, * but we also have to consider Providers. We return ‘false’ as soon * as we find something that matches the conflict, and only describe @@ -421,7 +421,7 @@ depisok(struct dependency *dep, struct varbuf *whynot, * other packages which provide the same virtual name. We * therefore don't look at the real package and go on to the * virtual ones. */ - + switch (possi->ed->clientdata->istobe) { case itb_remove: break; @@ -471,7 +471,6 @@ depisok(struct dependency *dep, struct varbuf *whynot, /* If there was no version specified we try looking for Providers. */ if (possi->verrel == dvr_none) { - /* See if the package we're about to install Provides it. */ for (provider= possi->ed->available.depended; provider; @@ -494,17 +493,17 @@ depisok(struct dependency *dep, struct varbuf *whynot, provider; provider = provider->rev_next) { if (provider->up->type != dep_provides) continue; - + if (provider->up->up == dep->up) continue; /* Conflicts and provides the same. */ - + switch (provider->up->up->clientdata->istobe) { case itb_installnew: /* Don't pay any attention to the Provides field of the * currently-installed version of the package we're trying * to install. We dealt with that package by using the * available information above. */ - continue; + continue; case itb_remove: continue; case itb_deconfigure: diff --git a/src/divertdb.c b/src/divertdb.c index 1449c64ee..a83f75ca2 100644 --- a/src/divertdb.c +++ b/src/divertdb.c @@ -124,4 +124,3 @@ ensure_diversions(void) onerr_abort--; } - diff --git a/src/enquiry.c b/src/enquiry.c index a130f838c..16deb18ce 100644 --- a/src/enquiry.c +++ b/src/enquiry.c @@ -199,7 +199,7 @@ void unpackchk(const char *const *argv) { const char *thissect; char buf[20]; int width; - + if (*argv) badusage(_("--%s takes no arguments"), cipaction->olong); @@ -228,7 +228,7 @@ void unpackchk(const char *const *argv) { pkg_db_iter_free(it); if (totalcount == 0) exit(0); - + if (totalcount <= 12) { it = pkg_db_iter_new(); while ((pkg = pkg_db_iter_next(it))) { @@ -338,7 +338,7 @@ void assertmulticonrep(const char *const *argv) { */ void predeppackage(const char *const *argv) { static struct varbuf vb; - + struct pkgiterator *it; struct pkginfo *pkg = NULL, *startpkg, *trypkg; struct dependency *dep; @@ -481,7 +481,7 @@ void cmpversions(const char *const *argv) { const char *emsg; struct versionrevision a, b; int r; - + if (!argv[0] || !argv[1] || !argv[2] || argv[3]) badusage(_("--compare-versions takes three arguments:" " <version> <relation> <version>")); diff --git a/src/errors.c b/src/errors.c index 3b4ceac53..b00da578a 100644 --- a/src/errors.c +++ b/src/errors.c @@ -56,7 +56,7 @@ static struct error_report emergency; void print_error_perpackage(const char *emsg, const char *arg) { struct error_report *nr; - + fprintf(stderr, _("%s: error processing %s (--%s):\n %s\n"), thisname, arg, cipaction->olong, emsg); @@ -74,7 +74,7 @@ void print_error_perpackage(const char *emsg, const char *arg) { nr->next = NULL; *lastreport= nr; lastreport= &nr->next; - + if (nerrs++ < errabort) return; fprintf(stderr, _("%s: too many errors, stopping\n"), thisname); abort_processing = true; diff --git a/src/filesdb.c b/src/filesdb.c index db929c47a..64c2a9dd5 100644 --- a/src/filesdb.c +++ b/src/filesdb.c @@ -260,7 +260,7 @@ ensure_packagefiles_available(struct pkginfo *pkg) filelistfile= pkgadminfile(pkg,LISTFILE); onerr_abort++; - + fd= open(filelistfile,O_RDONLY); if (fd==-1) { @@ -278,7 +278,7 @@ ensure_packagefiles_available(struct pkginfo *pkg) } push_cleanup(cu_closefd, ehflag_bombout, NULL, 0, 1, &fd); - + if(fstat(fd, &stat_buf)) ohshite(_("unable to stat files list file for package '%.250s'"), pkg->name); @@ -286,13 +286,13 @@ ensure_packagefiles_available(struct pkginfo *pkg) if (stat_buf.st_size) { loaded_list = nfmalloc(stat_buf.st_size); loaded_list_end = loaded_list + stat_buf.st_size; - + fd_buf_copy(fd, loaded_list, stat_buf.st_size, _("files list for package `%.250s'"), pkg->name); - + lendp= &pkg->clientdata->files; thisline = loaded_list; while (thisline < loaded_list_end) { - if (!(ptr = memchr(thisline, '\n', loaded_list_end - thisline))) + if (!(ptr = memchr(thisline, '\n', loaded_list_end - thisline))) ohshit(_("files list file for package '%.250s' is missing final newline"), pkg->name); /* Where to start next time around. */ @@ -473,7 +473,7 @@ write_filelist_except(struct pkginfo *pkg, struct fileinlist *list, varbufaddstr(&newvb,vb.buf); varbufaddstr(&newvb,NEWDBEXT); varbufaddc(&newvb,0); - + file= fopen(newvb.buf,"w+"); if (!file) ohshite(_("unable to create updated files list file for package %s"),pkg->name); @@ -512,7 +512,7 @@ write_filelist_except(struct pkginfo *pkg, struct fileinlist *list, void reversefilelist_init(struct reversefilelistiter *iterptr, struct fileinlist *files) { struct fileinlist *newent; - + iterptr->todo = NULL; while (files) { newent= m_malloc(sizeof(struct fileinlist)); diff --git a/src/filesdb.h b/src/filesdb.h index c3879c4f2..95605bfd0 100644 --- a/src/filesdb.h +++ b/src/filesdb.h @@ -100,7 +100,7 @@ struct filenamenode { struct stat *filestat; struct trigfileint *trig_interested; }; - + struct fileinlist { struct fileinlist *next; struct filenamenode *namenode; diff --git a/src/help.c b/src/help.c index 0778975b5..82d9cd0e5 100644 --- a/src/help.c +++ b/src/help.c @@ -57,19 +57,19 @@ const char *const statusstrings[]= { struct filenamenode *namenodetouse(struct filenamenode *namenode, struct pkginfo *pkg) { struct filenamenode *r; - + if (!namenode->divert) { r = namenode; return r; } - + debug(dbg_eachfile,"namenodetouse namenode=`%s' pkg=%s", namenode->name,pkg->name); - + r= (namenode->divert->useinstead && namenode->divert->pkg != pkg) ? namenode->divert->useinstead : namenode; - + debug(dbg_eachfile, "namenodetouse ... useinstead=%s camefrom=%s pkg=%s return %s", namenode->divert->useinstead ? namenode->divert->useinstead->name : "<none>", @@ -93,7 +93,7 @@ void checkpath(void) { "ldconfig", #if WITH_START_STOP_DAEMON "start-stop-daemon", -#endif +#endif "update-rc.d", NULL }; @@ -209,7 +209,7 @@ preexecscript(struct command *cmd) return cmd->filename; assert(strlen(cmd->filename) >= instdirl); return cmd->filename + instdirl; -} +} void post_postinst_tasks(struct pkginfo *pkg, enum pkgstatus new_status) @@ -359,7 +359,7 @@ maintainer_script_new(struct pkginfo *pkg, struct stat stab; va_list args; char buf[100]; - + strcpy(cidirrest, scriptname); sprintf(buf, _("new %s script"), desc); @@ -503,7 +503,7 @@ isdirectoryinuse(struct filenamenode *file, struct pkginfo *pkg) { struct filepackages_iterator *iter; struct pkginfo *other_pkg; - + debug(dbg_veryverbose, "isdirectoryinuse `%s' (except %s)", file->name, pkg ? pkg->name : "<none>"); @@ -523,7 +523,7 @@ isdirectoryinuse(struct filenamenode *file, struct pkginfo *pkg) void oldconffsetflags(const struct conffile *searchconff) { struct filenamenode *namenode; - + while (searchconff) { namenode= findnamenode(searchconff->name, 0); /* XXX */ namenode->flags |= fnnf_old_conff; diff --git a/src/main.c b/src/main.c index 99423b9ea..9df3e75cb 100644 --- a/src/main.c +++ b/src/main.c @@ -247,7 +247,7 @@ static void setdebug(const struct cmdinfo *cpi, const char *value) { m_output(stdout, _("<standard output>")); exit(0); } - + f_debug= strtoul(value,&endp,8); if (value == endp || *endp) badusage(_("--debug requires an octal argument")); } @@ -489,7 +489,7 @@ static const struct cmdinfo cmdinfos[]= { /* ACTION( "command-fd", 'c', act_commandfd, commandfd ), */ - + { "pre-invoke", 0, 1, NULL, NULL, set_invoke_hook, 0, &pre_invoke_hooks_tail }, { "post-invoke", 0, 1, NULL, NULL, set_invoke_hook, 0, &post_invoke_hooks_tail }, { "path-exclude", 0, 1, NULL, NULL, setfilter, 0 }, @@ -662,7 +662,6 @@ void commandfd(const char *const *argv) { } } - int main(int argc, const char *const *argv) { void (*actionfunction)(const char *const *argv); diff --git a/src/main.h b/src/main.h index 38cc5386c..5a3558750 100644 --- a/src/main.h +++ b/src/main.h @@ -261,7 +261,7 @@ enum debugflags { dbg_triggersdetail = 020000, dbg_triggersstupid = 040000, }; - + void debug(int which, const char *fmt, ...) DPKG_ATTR_PRINTF(2); void log_action(const char *action, struct pkginfo *pkg); diff --git a/src/packages.c b/src/packages.c index 2a912ac9c..1bb5f8af3 100644 --- a/src/packages.c +++ b/src/packages.c @@ -155,7 +155,7 @@ void process_queue(void) { volatile enum action action_todo; jmp_buf ejbuf; enum istobes istobe= itb_normal; - + if (abort_processing) return; @@ -191,7 +191,7 @@ void process_queue(void) { rundown->pkg->clientdata->istobe= istobe; } } - + while (!pkg_queue_is_empty(&queue)) { pkg = pkg_queue_pop(&queue); if (!pkg) @@ -256,7 +256,7 @@ void process_queue(void) { pop_error_context(ehflag_normaltidy); } assert(!queue.length); -} +} /*** Dependency processing - common to --configure and --remove. ***/ @@ -316,7 +316,7 @@ static int deppossi_ok_found(struct pkginfo *possdependee, int *interestingwarnings, struct varbuf *oemsgs) { int thisf; - + if (ignore_depends(possdependee)) { debug(dbg_depcondetail," ignoring depended package so ok and found"); return 3; @@ -609,7 +609,7 @@ int dependencies_ok(struct pkginfo *pkg, struct pkginfo *removing, ok= 1; if (!anycannotfixbytrig && canfixbytrig) progress_bytrigproc = canfixbytrig; - + varbuf_destroy(&oemsgs); debug(dbg_depcon,"ok %d msgs >>%.*s<<", ok, (int)aemsgs->used, aemsgs->buf); return ok; diff --git a/src/processarc.c b/src/processarc.c index eb07b44d6..e5ec4aa6a 100644 --- a/src/processarc.c +++ b/src/processarc.c @@ -100,7 +100,7 @@ void process_archive(const char *filename) { static enum pkgstatus oldversionstatus; static struct varbuf infofnvb, fnvb, depprobwhy; static struct tarcontext tc; - + int c1, r, admindirlen, i, infodirlen, infodirbaseused; struct pkgiterator *it; struct pkginfo *pkg, *otherpkg, *divpkg; @@ -122,7 +122,7 @@ void process_archive(const char *filename) { struct stat stab, oldfs; struct pkg_deconf_list *deconpil, *deconpiltemp; struct rename_list *rename_head = NULL, *rename_node = NULL; - + cleanup_pkg_failed= cleanup_conflictor_failed= 0; admindirlen= strlen(admindir); @@ -167,7 +167,7 @@ void process_archive(const char *filename) { subproc_check(status, SPLITTER, 0); } } - + /* Verify the package. */ if (!f_nodebsig && (stat(DEBSIGVERIFY, &stab)==0)) { printf(_("Authenticating %s ...\n"), filename); @@ -192,7 +192,7 @@ void process_archive(const char *filename) { } } } - + if (f_noact) { if (!cidirbuf) @@ -219,7 +219,7 @@ void process_archive(const char *filename) { ensure_pathname_nonexisting(cidir); cidirrest[-1] = '/'; } - + push_cleanup(cu_cidir, ~0, NULL, 0, 2, (void *)cidir, (void *)cidirrest); c1 = subproc_fork(); if (!c1) { @@ -326,7 +326,7 @@ void process_archive(const char *filename) { if (psearch->up->type != dep_conflicts) continue; check_conflict(psearch->up, pkg, pfilename); } - + ensure_allinstfiles_available(); filesdbinit(); trig_file_interests_ensure(); @@ -377,7 +377,7 @@ void process_archive(const char *filename) { namenode= findnamenode(conffilenamebuf, 0); namenode->oldhash= NEWCONFFILEFLAG; newconff= newconff_append(&newconffileslastp, namenode); - + /* Let's see if any packages have this file. If they do we * check to see if they listed it as a conffile, and if they did * we copy the hash across. Since (for plain file conffiles, @@ -435,13 +435,13 @@ void process_archive(const char *filename) { for (i = 0 ; i < cflict_index ; i++) { oldconffsetflags(conflictor[i]->installed.conffiles); } - + oldversionstatus= pkg->status; assert(oldversionstatus <= stat_installed); debug(dbg_general,"process_archive oldversionstatus=%s", statusstrings[oldversionstatus]); - + if (oldversionstatus == stat_halfconfigured || oldversionstatus == stat_triggersawaited || oldversionstatus == stat_triggerspending || @@ -540,7 +540,7 @@ void process_archive(const char *filename) { NULL); printf(_("Unpacking replacement %.250s ...\n"),pkg->name); } - + /* * Now we unpack the archive, backing things up as we go. * For each file, we check to see if it already exists. @@ -579,7 +579,7 @@ void process_archive(const char *filename) { * B: ordinary backup * R: later remove from other packages' lists * -: do nothing - * + * * After we've done this we go through the remaining things in the * lists of packages we're trying to remove (including the old * version of the current package). This happens in reverse order, @@ -674,7 +674,7 @@ void process_archive(const char *filename) { * conflicting package's file list, which will have been updated to * remove any files in this package. */ push_checkpoint(~ehflag_bombout, ehflag_normaltidy); - + /* Now we delete all the files that were in the old version of * the package only, except (old or new) conffiles, which we leave * alone. */ @@ -802,7 +802,7 @@ void process_archive(const char *filename) { } continue; } - + if (sameas) continue; @@ -851,6 +851,7 @@ void process_archive(const char *filename) { continue; if (strlen(pkg->name) != (size_t)(p-de->d_name) || strncmp(de->d_name,pkg->name,p-de->d_name)) continue; + debug(dbg_stupidlyverbose, "process_archive info this pkg"); /* Right, do we have one? */ @@ -866,6 +867,7 @@ void process_archive(const char *filename) { varbufaddstr(&infofnvb,de->d_name); varbufaddc(&infofnvb,0); strcpy(cidirrest,p); + /* We keep files to rename in a list as doing the rename immediately * might influence the current readdir(), the just renamed file might * be returned a second time as it's actually a new file from the @@ -897,7 +899,7 @@ void process_archive(const char *filename) { free(rename_node->dst); free(rename_node); } - + /* The directory itself. */ *cidirrest = '\0'; dsd= opendir(cidir); @@ -1003,8 +1005,8 @@ void process_archive(const char *filename) { pkg->installed.architecture= pkg->available.architecture; pkg->installed.installedsize= pkg->available.installedsize; pkg->installed.version= pkg->available.version; - pkg->installed.origin = pkg->available.origin; - pkg->installed.bugs = pkg->available.bugs; + pkg->installed.origin = pkg->available.origin; + pkg->installed.bugs = pkg->available.bugs; /* We have to generate our own conffiles structure. */ pkg->installed.conffiles = NULL; @@ -1056,7 +1058,7 @@ void process_archive(const char *filename) { if (cfile) continue; /* So dependency things will give right answers ... */ - otherpkg->clientdata->istobe= itb_remove; + otherpkg->clientdata->istobe= itb_remove; debug(dbg_veryverbose, "process_archive disappear checking dependencies"); for (pdep= otherpkg->installed.depended; pdep; @@ -1104,7 +1106,7 @@ void process_archive(const char *filename) { trig_activate_packageprocessing(otherpkg); maintainer_script_installed(otherpkg, POSTRMFILE, "post-removal script (for disappearance)", - "disappear", pkg->name, + "disappear", pkg->name, versiondescribe(&pkg->available.version, vdew_nonambig), NULL); @@ -1118,7 +1120,7 @@ void process_archive(const char *filename) { push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)dsd); debug(dbg_general, "process_archive disappear cleaning info directory"); - + while ((de = readdir(dsd)) != NULL) { debug(dbg_veryverbose, "process_archive info file `%s'", de->d_name); if (de->d_name[0] == '.') continue; @@ -1138,7 +1140,7 @@ void process_archive(const char *filename) { dir_sync(dsd, fnvb.buf); pop_cleanup(ehflag_normaltidy); /* closedir */ - + otherpkg->status= stat_notinstalled; otherpkg->want = want_unknown; otherpkg->eflag = eflag_ok; @@ -1152,7 +1154,7 @@ void process_archive(const char *filename) { } /* while (otherpkg= ... */ pkg_db_iter_free(it); - + /* Delete files from any other packages' lists. * We have to do this before we claim this package is in any * sane kind of state, as otherwise we might delete by mistake @@ -1175,7 +1177,7 @@ void process_archive(const char *filename) { debug(dbg_eachfile, "process_archive looking for overwriting `%s' (overridden by %s)", cfile->namenode->name, divpkg ? divpkg->name : "<local>"); - } + } } else { divpkg = NULL; debug(dbg_eachfile, "process_archive looking for overwriting `%s'", @@ -1209,7 +1211,7 @@ void process_archive(const char *filename) { * it happens (we leave the reinstall required flag, of course). */ pkg->status= stat_unpacked; modstatdb_note(pkg); - + /* Now we delete all the backup files that we made when * extracting the archive - except for files listed as conffiles * in the new package. diff --git a/src/querycmd.c b/src/querycmd.c index eecd0566c..74bdabbe5 100644 --- a/src/querycmd.c +++ b/src/querycmd.c @@ -80,7 +80,7 @@ list1package(struct pkginfo *pkg, bool *head, struct pkg_array *array) static int nw,vw,dw; const char *pdesc; static char format[80] = ""; - + if (format[0] == '\0') { w=getwidth(); if (w == -1) { @@ -264,7 +264,7 @@ searchfiles(const char *const *argv) int failures = 0; struct varbuf path = VARBUF_INIT; static struct varbuf vb; - + if (!*argv) badusage(_("--search needs at least one file name pattern argument")); @@ -330,20 +330,19 @@ enqperpackage(const char *const *argv) struct pkginfo *pkg; struct filenamenode *namenode; int failures = 0; - + if (!*argv) badusage(_("--%s needs at least one package name argument"), cipaction->olong); if (cipaction->arg==act_listfiles) modstatdb_init(admindir,msdbrw_readonly|msdbrw_noavail); - else + else modstatdb_init(admindir,msdbrw_readonly); while ((thisarg = *argv++) != NULL) { pkg = pkg_db_find(thisarg); switch (cipaction->arg) { - case act_status: if (pkg->status == stat_notinstalled && pkg->priority == pri_unknown && @@ -357,7 +356,6 @@ enqperpackage(const char *const *argv) writerecord(stdout, _("<standard output>"), pkg, &pkg->installed); } break; - case act_printavail: if (!pkg_is_informative(pkg, &pkg->available)) { fprintf(stderr,_("Package `%s' is not available.\n"),pkg->name); @@ -366,14 +364,12 @@ enqperpackage(const char *const *argv) writerecord(stdout, _("<standard output>"), pkg, &pkg->available); } break; - case act_listfiles: switch (pkg->status) { - case stat_notinstalled: + case stat_notinstalled: fprintf(stderr,_("Package `%s' is not installed.\n"),pkg->name); failures++; break; - default: ensure_packagefiles_available(pkg); ensure_diversions(); @@ -402,7 +398,6 @@ enqperpackage(const char *const *argv) break; } break; - default: internerr("unknown action '%d'", cipaction->arg); } diff --git a/src/remove.c b/src/remove.c index 7f629b2c2..fedc78f0f 100644 --- a/src/remove.c +++ b/src/remove.c @@ -52,7 +52,7 @@ static void checkforremoval(struct pkginfo *pkgtoremove, struct deppossi *possi; struct pkginfo *depender; int before, ok; - + for (possi = pkgdepcheck->installed.depended; possi; possi = possi->rev_next) { if (possi->up->type != dep_depends && possi->up->type != dep_predepends) continue; depender= possi->up->up; @@ -82,7 +82,7 @@ void deferred_remove(struct pkginfo *pkg) { struct dependency *dep; debug(dbg_general,"deferred_remove package %s",pkg->name); - + if (pkg->status == stat_notinstalled) { warning(_("ignoring request to remove %.250s which isn't installed."), pkg->name); @@ -152,7 +152,7 @@ void deferred_remove(struct pkginfo *pkg) { } oldconffsetflags(pkg->installed.conffiles); - + printf(_("Removing %s ...\n"),pkg->name); log_action("remove", pkg); trig_activate_packageprocessing(pkg); @@ -184,7 +184,7 @@ static void push_leftover(struct fileinlist **leftoverp, } static void removal_bulk_remove_files( - struct pkginfo *pkg, + struct pkginfo *pkg, bool *out_foundpostrm) { int before; @@ -196,7 +196,7 @@ static void removal_bulk_remove_files( DIR *dsd; struct dirent *de; struct stat stab; - + pkg->status= stat_halfinstalled; modstatdb_note(pkg); push_checkpoint(~ehflag_bombout, ehflag_normaltidy); @@ -220,19 +220,19 @@ static void removal_bulk_remove_files( varbufaddstr(&fnvb,instdir); varbufaddstr(&fnvb, usenode->name); before= fnvb.used; - + varbufaddstr(&fnvb,DPKGTEMPEXT); varbufaddc(&fnvb,0); debug(dbg_eachfiledetail, "removal_bulk cleaning temp `%s'", fnvb.buf); - + ensure_pathname_nonexisting(fnvb.buf); - + varbuf_trunc(&fnvb, before); varbufaddstr(&fnvb,DPKGNEWEXT); varbufaddc(&fnvb,0); debug(dbg_eachfiledetail, "removal_bulk cleaning new `%s'", fnvb.buf); ensure_pathname_nonexisting(fnvb.buf); - + varbuf_trunc(&fnvb, before); varbufaddc(&fnvb,0); if (!stat(fnvb.buf,&stab) && S_ISDIR(stab.st_mode)) { @@ -306,7 +306,7 @@ static void removal_bulk_remove_files( dir_sync(dsd, fnvb.buf); pop_cleanup(ehflag_normaltidy); /* closedir */ - + pkg->status= stat_configfiles; pkg->installed.essential = false; modstatdb_note(pkg); @@ -403,7 +403,7 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { * about which version it was ... */ blankversion(&pkg->configversion); modstatdb_note(pkg); - + /* Remove from our list any conffiles that aren't ours any more or * are involved in diversions, except if we are the package doing the * diverting. */ @@ -428,7 +428,7 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { } } modstatdb_note(pkg); - + for (conff= pkg->installed.conffiles; conff; conff= conff->next) { static struct varbuf fnvb, removevb; if (conff->obsolete) { @@ -496,12 +496,11 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { removevb.buf, conff->name); } pop_cleanup(ehflag_normaltidy); /* closedir */ - } - + pkg->installed.conffiles = NULL; modstatdb_note(pkg); - + maintainer_script_installed(pkg, POSTRMFILE, "post-removal", "purge", NULL); } @@ -535,7 +534,7 @@ void removal_bulk(struct pkginfo *pkg) { } debug(dbg_general, "removal_bulk purging? foundpostrm=%d",foundpostrm); - + if (!foundpostrm && !pkg->installed.conffiles) { /* If there are no config files and no postrm script then we * go straight into ‘purge’. */ @@ -560,12 +559,12 @@ void removal_bulk(struct pkginfo *pkg) { varbufaddstr(&fnvb, pkgadmindir()); varbufaddstr(&fnvb,pkg->name); pkgnameused= fnvb.used; - + varbufaddstr(&fnvb,"." LISTFILE); varbufaddc(&fnvb,0); debug(dbg_general, "removal_bulk purge done, removing list `%s'",fnvb.buf); if (unlink(fnvb.buf) && errno != ENOENT) ohshite(_("cannot remove old files list")); - + varbuf_trunc(&fnvb, pkgnameused); varbufaddstr(&fnvb,"." POSTRMFILE); varbufaddc(&fnvb,0); @@ -579,10 +578,9 @@ void removal_bulk(struct pkginfo *pkg) { * we won't go back because pkg->status is stat_notinstalled. */ pkg_perfile_blank(&pkg->installed); } - + pkg->eflag = eflag_ok; modstatdb_note(pkg); debug(dbg_general, "removal done"); } - diff --git a/src/select.c b/src/select.c index 51496a86b..0d2610dee 100644 --- a/src/select.c +++ b/src/select.c @@ -42,7 +42,7 @@ static void getsel1package(struct pkginfo *pkg) { if (pkg->want == want_unknown) return; l= strlen(pkg->name); l >>= 3; l= 6-l; if (l<1) l=1; printf("%s%.*s%s\n",pkg->name,l,"\t\t\t\t\t\t",wantinfos[pkg->want].name); -} +} void getselections(const char *const *argv) { struct pkg_array array; diff --git a/src/statcmd.c b/src/statcmd.c index 43a10988e..aed928fb3 100644 --- a/src/statcmd.c +++ b/src/statcmd.c @@ -397,4 +397,3 @@ main(int argc, const char *const *argv) return ret; } - diff --git a/src/statdb.c b/src/statdb.c index adeaef0ed..ff738756c 100644 --- a/src/statdb.c +++ b/src/statdb.c @@ -223,4 +223,3 @@ ensure_statoverrides(void) onerr_abort--; } - diff --git a/src/trigcmd.c b/src/trigcmd.c index 0366ec4d6..482d2e30f 100644 --- a/src/trigcmd.c +++ b/src/trigcmd.c @@ -237,4 +237,3 @@ main(int argc, const char *const *argv) return 0; } - diff --git a/src/trigproc.c b/src/trigproc.c index 568cdd1a7..bb69c7c20 100644 --- a/src/trigproc.c +++ b/src/trigproc.c @@ -419,4 +419,3 @@ trigproc_install_hooks(void) { trig_override_hooks(&trig_our_hooks); } - diff --git a/src/update.c b/src/update.c index 1cb354ce7..ffdce3dc4 100644 --- a/src/update.c +++ b/src/update.c @@ -50,7 +50,7 @@ void updateavailable(const char *const *argv) { default: internerr("unknown action '%d'", cipaction->arg); } - + if (!f_noact) { if (access(admindir,W_OK)) { if (errno != EACCES) @@ -60,7 +60,7 @@ void updateavailable(const char *const *argv) { } modstatdb_lock(admindir); } - + switch (cipaction->arg) { case act_avreplace: printf(_("Replacing available packages info, using %s.\n"),sourcefile); |