Commit ef1ba04c by Serge Hallyn Committed by Stéphane Graber

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: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent 8ab1f94b
......@@ -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 <assert.h>
#include <stdio.h>
#include <errno.h>
#include <limits.h>
......@@ -266,7 +267,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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment