If mtab does not contain the new entry, then only mc0->prev is updated
to point to absent, but not the old mc0->prev's nxt pointer. Because
we then use the nxt pointers to write the new mtab, absent is not
added to the new mtab.
(Note: fortunately, the mount doesn't use the update_mtab() for new
mounts, but for remount, move and umount only -- kzak)
If mtab is empty, absent->prev should be set to mc0, and not
mc0->prev, as it will be NULL.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
absent->m.mnt_freq = instead->mnt_freq;
absent->m.mnt_passno = instead->mnt_passno;
absent->nxt = mc0;
- absent->prev = mc0->prev;
+ if (mc0->prev != NULL) {
+ absent->prev = mc0->prev;
+ mc0->prev->nxt = absent;
+ } else {
+ absent->prev = mc0;
+ }
mc0->prev = absent;
if (mc0->nxt == NULL)
mc0->nxt = absent;