diff options
author | trasz <trasz@FreeBSD.org> | 2015-01-26 13:21:30 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2015-01-26 13:21:30 +0000 |
commit | 13678d19f252468c174267a7329bf0298aca8dff (patch) | |
tree | 38e7aa0481e14d3a68e43a54db4437df1b76343e /usr.sbin | |
parent | 9aa94c3abb200ad81c8e861fa4f88a774cd875ba (diff) | |
download | FreeBSD-src-13678d19f252468c174267a7329bf0298aca8dff.zip FreeBSD-src-13678d19f252468c174267a7329bf0298aca8dff.tar.gz |
MFC r274791:
Add missing error checking for kernel_port_{add,remove}(). Both can fail
for reasons yet unknown; don't make it increment cumulated_error as a kind
of temporary workaround.
MFC r275399:
Fix null pointer dereference.
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ctld/ctld.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 0565339..ca66d33 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -1680,7 +1680,16 @@ conf_apply(struct conf *oldconf, struct conf *newconf) cumulated_error++; } } - kernel_port_remove(oldtarg); + error = kernel_port_remove(oldtarg); + if (error != 0) { + log_warnx("failed to remove target %s", + oldtarg->t_name); + /* + * XXX: Uncomment after fixing the root cause. + * + * cumulated_error++; + */ + } continue; } @@ -1814,8 +1823,18 @@ conf_apply(struct conf *oldconf, struct conf *newconf) cumulated_error++; } } - if (oldtarg == NULL) - kernel_port_add(newtarg); + if (oldtarg == NULL) { + error = kernel_port_add(newtarg); + if (error != 0) { + log_warnx("failed to add target %s", + newtarg->t_name); + /* + * XXX: Uncomment after fixing the root cause. + * + * cumulated_error++; + */ + } + } } /* |