MFC r264151:

Prevent alq from panic when the invalid alq_file path specified.
This commit is contained in:
dchagin 2014-04-12 06:50:11 +00:00
parent fde2f5ed58
commit ee7f22ddbc

View File

@ -488,10 +488,12 @@ alq_open(struct alq **alqp, const char *file, struct ucred *cred, int cmode,
KASSERT((count >= 0), ("%s: count < 0", __func__));
if (count > 0) {
ret = alq_open_flags(alqp, file, cred, cmode, size*count, 0);
(*alqp)->aq_flags |= AQ_LEGACY;
(*alqp)->aq_entmax = count;
(*alqp)->aq_entlen = size;
if ((ret = alq_open_flags(alqp, file, cred, cmode,
size*count, 0)) == 0) {
(*alqp)->aq_flags |= AQ_LEGACY;
(*alqp)->aq_entmax = count;
(*alqp)->aq_entlen = size;
}
} else
ret = alq_open_flags(alqp, file, cred, cmode, size, 0);