free(sres);
login_getcaptime(lc, cap, def, e)	login_cap_t *lc;	char *cap;	quad_t def;	quad_t e;{	char *ep;	char *res, *sres;	int stat;	quad_t q, r;	errno = 0;    	if (!lc->lc_cap)		return (def);	switch (stat = cgetstr(lc->lc_cap, cap, &res)) {	case -1:		return (def);	case -2:		syslog(LOG_ERR, "%s: getting capability %s: %m",		    lc->lc_class, cap);		errno = ERANGE;		return (e);	default:		if (stat >= 0) 			break;		syslog(LOG_ERR, "%s: unexpected error with capability %s",		    lc->lc_class, cap);		errno = ERANGE;		return (e);	}	if (strcasecmp(res, "infinity") == 0)		return (RLIM_INFINITY);	errno = 0;	q = 0;	sres = res;	while (*res) {		r = strtoq(res, &ep, 0);		if (!ep || ep == res ||		    ((r == QUAD_MIN || r == QUAD_MAX) && errno == ERANGE)) {invalid:			syslog(LOG_ERR, "%s:%s=%s: invalid time",			    lc->lc_class, cap, sres);			errno = ERANGE;			return (e);		}		switch (*ep++) {		case '\0':			--ep;			break;		case 's': case 'S':			break;		case 'm': case 'M':			r *= 60;			break;		case 'h': case 'H':			r *= 60 * 60;			break;		case 'd': case 'D':			r *= 60 * 60 * 24;			break;		case 'w': case 'W':			r *= 60 * 60 * 24 * 7;			break;		case 'y': case 'Y':	/* Pretty absurd */			r *= 60 * 60 * 24 * 365;			break;		default:			goto invalid;		}		res = ep;		q += r;	}	return (q);}