Prevent alq from panic when the invalid alq_file path specified.

MFC after:	1 week
This commit is contained in:
dchagin 2014-04-05 16:54:47 +00:00
parent 6c1fcc9eea
commit e0cab82fb2

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);