Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 68434 Details for
Bug 105641
sys-apps/util-linux-2.12q-r1 - mount does not add an entry for / to /etc/mtab
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
util-linux-2.12q-update_mtab-fixes.patch
util-linux-2.12q-update_mtab-fixes.patch (text/plain), 2.18 KB, created by
Martin Schlemmer (RETIRED)
on 2005-09-14 02:03:39 UTC
(
hide
)
Description:
util-linux-2.12q-update_mtab-fixes.patch
Filename:
MIME Type:
Creator:
Martin Schlemmer (RETIRED)
Created:
2005-09-14 02:03:39 UTC
Size:
2.18 KB
patch
obsolete
>This fixes a few issues with update_mtab(): >- If it is a remount, and only mnt_opts needs updating, mc->m.mnt_opts is set > to point to instead->mnt_opts, rather than allocating a new string, which > would cause a double free if the caller actually freed the passed mnt_opts, > as we free mc->m.mnt_opts before returning to the caller. >- Mostly the same issue as above. If mtab does not contain the new entry, then > absent->m is set to point to instead, which would have cause a double free > if absent was inserted properly into the linked list, since we free all > elements of absent before returning to the caller. >- 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. >- If mtab is empty, absent->prev should be set to mc0, and not mc0->prev, as > it will be NULL. > > >--- util-linux-2.12q/mount/fstab.c 2005-09-14 08:22:34.000000000 +0200 >+++ util-linux-2.12q.az/mount/fstab.c 2005-09-14 10:37:54.000000000 +0200 >@@ -604,15 +604,30 @@ update_mtab (const char *dir, struct my_ > free(mc); > } > } else { >- /* A remount */ >- mc->m.mnt_opts = instead->mnt_opts; >+ /* A remount. Need to alloc memory, else we might >+ * run into issues if both we and the caller frees >+ * mnt_opts ... */ >+ mc->m.mnt_opts = xstrdup(instead->mnt_opts); > } > } else if (instead) { > /* not found, add a new entry */ > absent = xmalloc(sizeof(*absent)); >- absent->m = *instead; >+ /* Cannot just set absent->m to instread, as we free absent >+ * below, and the caller might free instead */ >+ absent->m.mnt_fsname = xstrdup(instead->mnt_fsname); >+ absent->m.mnt_dir = xstrdup(instead->mnt_dir); >+ absent->m.mnt_type = xstrdup(instead->mnt_type); >+ absent->m.mnt_opts = xstrdup(instead->mnt_opts); >+ 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;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 105641
: 68434