Skip to content

Commit 4a5943a

Browse files
authored
Merge pull request #1272 from teselkin/fix-dpkginfo-init-1.2
dpkginfo_init doesn't check if dpkg cache initialization has succeeded.
2 parents 5e7b30d + 5f4cf98 commit 4a5943a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/OVAL/probes/unix/linux/dpkginfo.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,23 @@
6262

6363

6464
struct dpkginfo_global {
65+
int init_done;
6566
pthread_mutex_t mutex;
6667
};
6768

68-
static struct dpkginfo_global g_dpkg;
69+
static struct dpkginfo_global g_dpkg = {
70+
.init_done = -1,
71+
};
6972

7073

7174
void *probe_init(void)
7275
{
7376
pthread_mutex_init (&(g_dpkg.mutex), NULL);
74-
dpkginfo_init();
77+
78+
g_dpkg.init_done = dpkginfo_init();
79+
if (g_dpkg.init_done < 0) {
80+
dE("dpkginfo_init has failed.");
81+
}
7582

7683
return ((void *)&g_dpkg);
7784
}
@@ -97,6 +104,11 @@ int probe_main (probe_ctx *ctx, void *arg)
97104
return PROBE_EINIT;
98105
}
99106

107+
if (g_dpkg.init_done < 0) {
108+
probe_cobj_set_flag(probe_ctx_getresult(ctx), SYSCHAR_FLAG_UNKNOWN);
109+
return 0;
110+
}
111+
100112
obj = probe_ctx_getobject(ctx);
101113
ent = probe_obj_getent(obj, "name", 1);
102114

0 commit comments

Comments
 (0)