aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-05-15 17:42:16 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-05-15 17:42:16 +0000
commit4556650b13ac68ca7a536ac1664cc66cbb3e3b23 (patch)
treea0f435a6239c002578db8f019eb0fb427f1795b3 /util-linux
parent6ebe0d2d046886fcfc2a9bdd6294fe9c38932811 (diff)
downloadbusybox-w32-4556650b13ac68ca7a536ac1664cc66cbb3e3b23.tar.gz
busybox-w32-4556650b13ac68ca7a536ac1664cc66cbb3e3b23.tar.bz2
busybox-w32-4556650b13ac68ca7a536ac1664cc66cbb3e3b23.zip
Patch from Vladimir:
1) fixed a bug that could crash df, mount, and umount applets if the root device name was longer then the word "root" (/dev/loop1 vs /dev/root) - 2) severl functions needed static declaration in the umount applet 3) update declaration for function in last_char_is() in libbb git-svn-id: svn://busybox.net/trunk/busybox@2647 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mount.c6
-rw-r--r--util-linux/umount.c33
2 files changed, 21 insertions, 18 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 0295fabc6..4e0e3e428 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -319,10 +319,14 @@ void show_mounts()
319 while ((m = getmntent(mountTable)) != 0) { 319 while ((m = getmntent(mountTable)) != 0) {
320 char *blockDevice = m->mnt_fsname; 320 char *blockDevice = m->mnt_fsname;
321 if (strcmp(blockDevice, "/dev/root") == 0) { 321 if (strcmp(blockDevice, "/dev/root") == 0) {
322 find_real_root_device_name( blockDevice); 322 blockDevice = find_real_root_device_name(blockDevice);
323 } 323 }
324 printf("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir, 324 printf("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir,
325 m->mnt_type, m->mnt_opts); 325 m->mnt_type, m->mnt_opts);
326#ifdef BB_FEATURE_CLEAN_UP
327 if(blockDevice != m->mnt_fsname)
328 free(blockDevice);
329#endif
326 } 330 }
327 endmntent(mountTable); 331 endmntent(mountTable);
328 } else { 332 } else {
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 0eade5a36..8565744f2 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -74,7 +74,7 @@ extern const char mtab_file[]; /* Defined in utility.c */
74 * TODO: Perhaps switch to using Glibc's getmntent_r 74 * TODO: Perhaps switch to using Glibc's getmntent_r
75 * -Erik 75 * -Erik
76 */ 76 */
77void mtab_read(void) 77static void mtab_read(void)
78{ 78{
79 struct _mtab_entry_t *entry = NULL; 79 struct _mtab_entry_t *entry = NULL;
80 struct mntent *e; 80 struct mntent *e;
@@ -97,7 +97,7 @@ void mtab_read(void)
97 endmntent(fp); 97 endmntent(fp);
98} 98}
99 99
100char *mtab_getinfo(const char *match, const char which) 100static char *mtab_getinfo(const char *match, const char which)
101{ 101{
102 struct _mtab_entry_t *cur = mtab_cache; 102 struct _mtab_entry_t *cur = mtab_cache;
103 103
@@ -111,8 +111,7 @@ char *mtab_getinfo(const char *match, const char which)
111 if (strcmp(cur->device, "/dev/root") == 0) { 111 if (strcmp(cur->device, "/dev/root") == 0) {
112 /* Adjusts device to be the real root device, 112 /* Adjusts device to be the real root device,
113 * or leaves device alone if it can't find it */ 113 * or leaves device alone if it can't find it */
114 find_real_root_device_name( cur->device); 114 cur->device = find_real_root_device_name(cur->device);
115 return ( cur->device);
116 } 115 }
117#endif 116#endif
118 return cur->device; 117 return cur->device;
@@ -123,18 +122,7 @@ char *mtab_getinfo(const char *match, const char which)
123 return NULL; 122 return NULL;
124} 123}
125 124
126char *mtab_first(void **iter) 125static char *mtab_next(void **iter)
127{
128 struct _mtab_entry_t *mtab_iter;
129
130 if (!iter)
131 return NULL;
132 mtab_iter = mtab_cache;
133 *iter = (void *) mtab_iter;
134 return mtab_next(iter);
135}
136
137char *mtab_next(void **iter)
138{ 126{
139 char *mp; 127 char *mp;
140 128
@@ -145,10 +133,21 @@ char *mtab_next(void **iter)
145 return mp; 133 return mp;
146} 134}
147 135
136static char *mtab_first(void **iter)
137{
138 struct _mtab_entry_t *mtab_iter;
139
140 if (!iter)
141 return NULL;
142 mtab_iter = mtab_cache;
143 *iter = (void *) mtab_iter;
144 return mtab_next(iter);
145}
146
148/* Don't bother to clean up, since exit() does that 147/* Don't bother to clean up, since exit() does that
149 * automagically, so we can save a few bytes */ 148 * automagically, so we can save a few bytes */
150#ifdef BB_FEATURE_CLEAN_UP 149#ifdef BB_FEATURE_CLEAN_UP
151void mtab_free(void) 150static void mtab_free(void)
152{ 151{
153 struct _mtab_entry_t *this, *next; 152 struct _mtab_entry_t *this, *next;
154 153