Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/libbb/mtab.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/libbb/mtab.c
r1765 r2725 5 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 6 6 * 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 9 … … 12 12 13 13 #if ENABLE_FEATURE_MTAB_SUPPORT 14 void erase_mtab(const char *name)14 void FAST_FUNC erase_mtab(const char *name) 15 15 { 16 struct mntent *entries = NULL;17 int i, count = 0;16 struct mntent *entries; 17 int i, count; 18 18 FILE *mountTable; 19 19 struct mntent *m; … … 27 27 } 28 28 29 entries = NULL; 30 count = 0; 29 31 while ((m = getmntent(mountTable)) != 0) { 30 i = count++;31 entries = xrealloc(entries, count * sizeof(entries[0]));32 entries[ i].mnt_fsname = xstrdup(m->mnt_fsname);33 entries[ i].mnt_dir = xstrdup(m->mnt_dir);34 entries[ i].mnt_type = xstrdup(m->mnt_type);35 entries[ i].mnt_opts = xstrdup(m->mnt_opts);36 entries[ i].mnt_freq = m->mnt_freq;37 entries[i].mnt_passno = m->mnt_passno;32 entries = xrealloc_vector(entries, 3, count); 33 entries[count].mnt_fsname = xstrdup(m->mnt_fsname); 34 entries[count].mnt_dir = xstrdup(m->mnt_dir); 35 entries[count].mnt_type = xstrdup(m->mnt_type); 36 entries[count].mnt_opts = xstrdup(m->mnt_opts); 37 entries[count].mnt_freq = m->mnt_freq; 38 entries[count].mnt_passno = m->mnt_passno; 39 count++; 38 40 } 39 41 endmntent(mountTable); 40 42 43 //TODO: make update atomic 41 44 mountTable = setmntent(bb_path_mtab_file, "w"); 42 45 if (mountTable) {
Note:
See TracChangeset
for help on using the changeset viewer.