Though it's more subtle than that. If the file doesn't exist or we
can't access it, then don't record it. But if we have parse errors,
then do.
This is mainly to help out API users who try to read a container
configuration file before calling c->create(). If the file doesn't
exist, then without this patch the subsequent create() will not
use the default /etc/lxc/default.conf. The API user could check
for the file ahead of time, but this check makes his life easier
without costing us anything.
Signed-off-by: S.Çağlar Onur" <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
int lxc_config_read(const char *file, struct lxc_conf *conf)
{
+ if( access(file, R_OK) == -1 ) {
+ return -1;
+ }
/* Catch only the top level config file name in the structure */
if( ! conf->rcfile ) {
conf->rcfile = strdup( file );