diff options
author | dd <dd@FreeBSD.org> | 2001-07-02 00:18:04 +0000 |
---|---|---|
committer | dd <dd@FreeBSD.org> | 2001-07-02 00:18:04 +0000 |
commit | 4a798fb83a60241d607536db8b69d9709995a803 (patch) | |
tree | eb3e6d3ae80fce772bbe283df44e815263d1b83f /usr.sbin/sysinstall/package.c | |
parent | b1763d41ddf8b57a46b69e3e8423b9d57392bd6a (diff) | |
download | FreeBSD-src-4a798fb83a60241d607536db8b69d9709995a803.zip FreeBSD-src-4a798fb83a60241d607536db8b69d9709995a803.tar.gz |
Introduce DEVICE_INIT, DEVICE_GET, and DEVICE_SHUTDOWN macros. As the
names suggest, they perform methods on Device's. In addition, they
check that the pointer passed to them is valid; if it isn't, they
pretend that the action failed. This fixes some crashes due to NULL
dereferences (e.g., PR 26509).
Approved by: jkh (some time ago)
Diffstat (limited to 'usr.sbin/sysinstall/package.c')
-rw-r--r-- | usr.sbin/sysinstall/package.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/sysinstall/package.c b/usr.sbin/sysinstall/package.c index 577421f..73600bf 100644 --- a/usr.sbin/sysinstall/package.c +++ b/usr.sbin/sysinstall/package.c @@ -61,7 +61,7 @@ package_add(char *name) if (!mediaVerify()) return DITEM_FAILURE; - if (!mediaDevice->init(mediaDevice)) + if (!DEVICE_INIT(mediaDevice)) return DITEM_FAILURE; i = index_initialize("packages/INDEX"); @@ -123,7 +123,7 @@ package_extract(Device *dev, char *name, Boolean depended) if (package_exists(name)) return DITEM_SUCCESS; - if (!dev->init(dev)) { + if (!DEVICE_INIT(dev)) { msgConfirm("Unable to initialize media type for package extract."); return DITEM_FAILURE; } @@ -154,7 +154,7 @@ package_extract(Device *dev, char *name, Boolean depended) sprintf(path, "%s%s", name, strstr(name, ".tgz") ? "" : ".tgz"); /* We have a path, call the device strategy routine to get the file */ - fp = dev->get(dev, path, TRUE); + fp = DEVICE_GET(dev, path, TRUE); if (fp) { int i = 0, tot, pfd[2]; pid_t pid; |