From owner-svn-src-stable-7@FreeBSD.ORG Sat Nov 1 13:45:04 2014 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CA63C457; Sat, 1 Nov 2014 13:45:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 86B4D91D; Sat, 1 Nov 2014 13:45:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1Dj4pw035642; Sat, 1 Nov 2014 13:45:04 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1Dj4tl035641; Sat, 1 Nov 2014 13:45:04 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201411011345.sA1Dj4tl035641@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 1 Nov 2014 13:45:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r273931 - in stable: 10/lib/libutil 7/lib/libutil 8/lib/libutil 9/lib/libutil X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 13:45:04 -0000 Author: dim Date: Sat Nov 1 13:45:01 2014 New Revision: 273931 URL: https://svnweb.freebsd.org/changeset/base/273931 Log: MFC r273837: Fix a clang 3.5 warning about abs(3) being given an argument of type quad_t in setusercontext(). While here, sanitize the clamping of the priority value, and use the correct type for the return value of login_getcapnum(). Reviewed by: kib Modified: stable/7/lib/libutil/login_class.c Directory Properties: stable/7/lib/libutil/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/libutil/login_class.c stable/8/lib/libutil/login_class.c stable/9/lib/libutil/login_class.c Directory Properties: stable/10/ (props changed) stable/8/lib/libutil/ (props changed) stable/9/lib/libutil/ (props changed) Modified: stable/7/lib/libutil/login_class.c ============================================================================== --- stable/7/lib/libutil/login_class.c Sat Nov 1 11:19:50 2014 (r273930) +++ stable/7/lib/libutil/login_class.c Sat Nov 1 13:45:01 2014 (r273931) @@ -420,7 +420,7 @@ setlogincontext(login_cap_t *lc, const s int setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned int flags) { - quad_t p; + rlim_t p; mode_t mymask; login_cap_t *llc = NULL; struct rtprio rtp; @@ -444,16 +444,16 @@ setusercontext(login_cap_t *lc, const st if (p > PRIO_MAX) { rtp.type = RTP_PRIO_IDLE; - rtp.prio = p - PRIO_MAX - 1; - p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p; + p -= PRIO_MAX + 1; + rtp.prio = p > RTP_PRIO_MAX ? RTP_PRIO_MAX : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", pwd ? pwd->pw_name : "-", lc ? lc->lc_class : LOGIN_DEFCLASS); } else if (p < PRIO_MIN) { rtp.type = RTP_PRIO_REALTIME; - rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX); - p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p; + p -= PRIO_MIN - RTP_PRIO_MAX; + rtp.prio = p < RTP_PRIO_MIN ? RTP_PRIO_MIN : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", pwd ? pwd->pw_name : "-",