From: Serge Hallyn Date: Mon, 15 Feb 2016 20:15:10 +0000 (-0800) Subject: log.c:__lxc_log_set_file: fname cannot be null X-Git-Tag: lxc-2.0.0.rc1~3^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f53c691d248434fdb817e615495d9c419af07d1;p=thirdparty%2Flxc.git log.c:__lxc_log_set_file: fname cannot be null fname cannot be passed in as NULL by any of its current callers. If it could, then build_dir() would crash as it doesn't check for it. So make sure we are warned if in the future we pass in NULL. Signed-off-by: Serge Hallyn --- diff --git a/src/lxc/log.c b/src/lxc/log.c index 20be5ac07..babaebc84 100644 --- a/src/lxc/log.c +++ b/src/lxc/log.c @@ -20,6 +20,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include #include @@ -268,7 +269,9 @@ static int __lxc_log_set_file(const char *fname, int create_dirs) free(log_fname); } - if (!fname || strlen(fname) == 0) { + assert(fname != NULL); + + if (strlen(fname) == 0) { log_fname = NULL; return 0; }