Date: Mon, 19 Jul 2010 19:52:02 +0000 (UTC) From: Jamie Gritton <jamie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r210252 - stable/8/lib/libjail Message-ID: <201007191952.o6JJq2px065851@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jamie Date: Mon Jul 19 19:52:02 2010 New Revision: 210252 URL: http://svn.freebsd.org/changeset/base/210252 Log: MFC r210134: Don't copy and return a potentially unset buffer when jail_get fails. Modified: stable/8/lib/libjail/jail_getid.c Directory Properties: stable/8/lib/libjail/ (props changed) Modified: stable/8/lib/libjail/jail_getid.c ============================================================================== --- stable/8/lib/libjail/jail_getid.c Mon Jul 19 19:51:17 2010 (r210251) +++ stable/8/lib/libjail/jail_getid.c Mon Jul 19 19:52:02 2010 (r210252) @@ -94,11 +94,15 @@ jail_getname(int jid) jiov[5].iov_len = JAIL_ERRMSGLEN; jail_errmsg[0] = 0; jid = jail_get(jiov, 6, 0); - if (jid < 0 && !jail_errmsg[0]) - snprintf(jail_errmsg, JAIL_ERRMSGLEN, "jail_get: %s", - strerror(errno)); - name = strdup(namebuf); - if (name == NULL) - strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); + if (jid < 0) { + if (!jail_errmsg[0]) + snprintf(jail_errmsg, JAIL_ERRMSGLEN, "jail_get: %s", + strerror(errno)); + return NULL; + } else { + name = strdup(namebuf); + if (name == NULL) + strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); + } return name; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007191952.o6JJq2px065851>