diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2012-05-11 09:53:06 -0400 |
---|---|---|
committer | Jan Zeleny <jzeleny@redhat.com> | 2012-05-15 09:08:30 +0200 |
commit | bf6d43a490ce791ece8df83554e46f9d1faabd99 (patch) | |
tree | c2e61930bb7c5c48196230c54fd991607bee1954 | |
parent | 013e9da407a3b583db93f827f054cd2fd6127739 (diff) | |
download | ding-libs2-bf6d43a490ce791ece8df83554e46f9d1faabd99.tar.gz ding-libs2-bf6d43a490ce791ece8df83554e46f9d1faabd99.tar.xz ding-libs2-bf6d43a490ce791ece8df83554e46f9d1faabd99.zip |
Properly handle file permissions for ini_parse_ut startup_test()
-rw-r--r-- | ini/ini_parse_ut.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/ini/ini_parse_ut.c b/ini/ini_parse_ut.c index 6cab9d4..826cce0 100644 --- a/ini/ini_parse_ut.c +++ b/ini/ini_parse_ut.c @@ -634,7 +634,6 @@ int merge_section_test(void) int startup_test(void) { int error = EOK; - int error2 = EOK; struct ini_cfgfile *file_ctx = NULL; struct ini_cfgobj *ini_config = NULL; char **error_list = NULL; @@ -642,6 +641,9 @@ int startup_test(void) memcpy(filename, FOO_CONF, sizeof(FOO_CONF)); + /* Ensure that we start with the correct file mode */ + chmod(filename, 0664); + INIOUT(printf("<==== Startup test ====>\n")); /* Open config file */ @@ -685,22 +687,9 @@ int startup_test(void) 0); if (error) { - /* In case the repo is created by root the permission is different */ - error2 = ini_config_access_check( - file_ctx, - INI_ACCESS_CHECK_MODE, /* add uid & gui flags - * in real case - */ - 0, /* <- will be real uid in real case */ - 0, /* <- will be real gid in real case */ - 0644, /* Checkling for rw-r-r-- */ - 0); - if(error2) { - printf("Access check failed twice: %d %d!\n", error, error2); - ini_config_file_destroy(file_ctx); - return EACCES; - } - /* If this check passed we are OK! */ + printf("Access check failed: %d!\n", error); + ini_config_file_destroy(file_ctx); + return EACCES; } /* Create config object */ |