diff options
author | jkh <jkh@FreeBSD.org> | 1994-09-29 13:19:43 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1994-09-29 13:19:43 +0000 |
commit | 3ef0581e73d5178f71ceb3fa2ec31b843c8d49b8 (patch) | |
tree | 0a54543e352f476b57ae299bf0e92040f9dc3a94 | |
parent | e9bb220eefc37eecee5de118173282f633485000 (diff) | |
download | FreeBSD-src-3ef0581e73d5178f71ceb3fa2ec31b843c8d49b8.zip FreeBSD-src-3ef0581e73d5178f71ceb3fa2ec31b843c8d49b8.tar.gz |
Don't let pkg_delete remove the recorded location until everything has
absolutely, positively been successfully removed.
Reviewed by:
Submitted by:
Obtained from:
-rw-r--r-- | usr.sbin/pkg_install/delete/perform.c | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/lib.h | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/plist.c | 14 |
3 files changed, 15 insertions, 9 deletions
diff --git a/usr.sbin/pkg_install/delete/perform.c b/usr.sbin/pkg_install/delete/perform.c index 6fce7db..0b94b2c 100644 --- a/usr.sbin/pkg_install/delete/perform.c +++ b/usr.sbin/pkg_install/delete/perform.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: perform.c,v 1.3 1993/10/08 01:19:35 jkh Exp $"; +static const char *rcsid = "$Id: perform.c,v 1.4 1994/05/25 18:00:02 asami Exp $"; #endif /* @@ -100,8 +100,8 @@ pkg_do(char *pkg) } if (chdir(home) == FAIL) barf("Toto! This doesn't look like Kansas anymore!"); - delete_package(FALSE, &Plist); - if (!Fake && vsystem("%s -r %s", REMOVE_CMD, LogDir)) { + if (!Fake && delete_package(FALSE, &Plist) != FAIL && + vsystem("%s -r %s", REMOVE_CMD, LogDir)) { whinge("Couldn't remove log entry in %s, de-install failed.", LogDir); return 1; } diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h index 4f34569..08de0be 100644 --- a/usr.sbin/pkg_install/lib/lib.h +++ b/usr.sbin/pkg_install/lib/lib.h @@ -1,4 +1,4 @@ -/* $Id: lib.h,v 1.7 1994/05/25 18:00:04 asami Exp $ */ +/* $Id: lib.h,v 1.8 1994/08/28 14:15:29 jkh Exp $ */ /* * FreeBSD install - a package for the installation and maintainance @@ -141,7 +141,7 @@ void add_plist_top(Package *, plist_t, char *); void write_plist(Package *, FILE *); void read_plist(Package *, FILE *); int plist_cmd(char *, char **); -void delete_package(Boolean, Package *); +int delete_package(Boolean, Package *); /* For all */ void usage(const char *, const char *, ...); diff --git a/usr.sbin/pkg_install/lib/plist.c b/usr.sbin/pkg_install/lib/plist.c index d2708fd..577ae5e 100644 --- a/usr.sbin/pkg_install/lib/plist.c +++ b/usr.sbin/pkg_install/lib/plist.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: plist.c,v 1.7 1994/07/11 01:11:14 jkh Exp $"; +static const char *rcsid = "$Id: plist.c,v 1.8 1994/08/28 14:15:30 jkh Exp $"; #endif /* @@ -296,11 +296,12 @@ write_plist(Package *pkg, FILE *fp) } /* Delete the results of a package installation, not the packaging itself */ -void +int delete_package(Boolean ign_err, Package *pkg) { PackingList p = pkg->head; char *Where = ".", *last_file = ""; + Boolean fail = SUCCESS; while (p) { if (p->type == PLIST_CWD) { @@ -314,8 +315,10 @@ delete_package(Boolean ign_err, Package *pkg) format_cmd(cmd, p->name, Where, last_file); if (Verbose) printf("unexec command: %s\n", cmd); - if (!Fake && system(cmd)) + if (!Fake && system(cmd)) { whinge("unexec '%s' failed.", cmd); + fail = FAIL; + } } else if (p->type == PLIST_IGNORE) p = p->next; @@ -326,12 +329,15 @@ delete_package(Boolean ign_err, Package *pkg) if (Verbose) printf("Delete: %s\n", full_name); - if (!Fake && delete_hierarchy(full_name, ign_err)) + if (!Fake && delete_hierarchy(full_name, ign_err)) { whinge("Unable to completely remove file '%s'", full_name); + fail = FAIL; + } last_file = p->name; } p = p->next; } + return fail; } /* Selectively delete a hierarchy */ |