summaryrefslogtreecommitdiffstats
path: root/ini/ini_parse_ut.c
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2013-01-26 16:47:56 -0500
committerOndrej Kos <okos@redhat.com>2013-01-28 10:47:33 +0100
commit059519fb2a8d056eba5f61cde98ed8b5292195d4 (patch)
treedc813f14b0ae1015bb700a36141e328044af2b92 /ini/ini_parse_ut.c
parent66e30c2f3862093505a8497744207d2812c95be3 (diff)
downloadding-libs2-059519fb2a8d056eba5f61cde98ed8b5292195d4.tar.gz
ding-libs2-059519fb2a8d056eba5f61cde98ed8b5292195d4.tar.xz
ding-libs2-059519fb2a8d056eba5f61cde98ed8b5292195d4.zip
Check is the stats we collected
This patch corrects a problem related to stats being accessed and evaluated without being initialized.
Diffstat (limited to 'ini/ini_parse_ut.c')
-rw-r--r--ini/ini_parse_ut.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/ini/ini_parse_ut.c b/ini/ini_parse_ut.c
index 002fdd5..c5e9166 100644
--- a/ini/ini_parse_ut.c
+++ b/ini/ini_parse_ut.c
@@ -1085,6 +1085,36 @@ int startup_test(void)
return error;
}
+ /* Open config file not collecting stats */
+ error = ini_config_file_open(outfile,
+ 0,
+ &file_ctx);
+ if (error) {
+ printf("Failed to open file %s for reading. Error %d.\n",
+ outfile, error);
+ return error;
+ }
+
+ /* We will check just permissions here. */
+ error = 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 */
+ 0440, /* Checking for r--r----- */
+ 0);
+ /* This check is expected to fail since
+ * we did not collect stats
+ */
+ ini_config_file_destroy(file_ctx);
+
+ if (!error) {
+ printf("Expected error got success!\n");
+ return EACCES;
+ }
+
+
/* Open config file */
error = ini_config_file_open(outfile,
INI_META_STATS,