diff options
Diffstat (limited to 'lib/rpmfs.c')
-rw-r--r-- | lib/rpmfs.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/rpmfs.c b/lib/rpmfs.c index 764618d94..7d807e06b 100644 --- a/lib/rpmfs.c +++ b/lib/rpmfs.c @@ -18,7 +18,7 @@ rpmfs rpmfsNew(rpm_count_t fc, int initState) rpmfs fs = xcalloc(1, sizeof(*fs)); fs->fc = fc; fs->actions = xmalloc(fs->fc * sizeof(*fs->actions)); - memset(fs->actions, FA_UNKNOWN, fs->fc * sizeof(*fs->actions)); + rpmfsResetActions(fs); if (initState) { fs->states = xmalloc(sizeof(*fs->states) * fs->fc); memset(fs->states, RPMFILE_STATE_NORMAL, fs->fc); @@ -101,7 +101,7 @@ rpm_fstate_t * rpmfsGetStates(rpmfs fs) rpmFileAction rpmfsGetAction(rpmfs fs, unsigned int ix) { rpmFileAction action; - if (fs->actions != NULL && ix < fs->fc) { + if (fs && fs->actions != NULL && ix < fs->fc) { action = fs->actions[ix]; } else { action = FA_UNKNOWN; @@ -115,3 +115,10 @@ void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action) fs->actions[ix] = action; } } + +void rpmfsResetActions(rpmfs fs) +{ + if (fs && fs->actions) { + memset(fs->actions, FA_UNKNOWN, fs->fc * sizeof(*fs->actions)); + } +} |